Sn3akyP3t3 Posted May 30, 2011 Share Posted May 30, 2011 I cannot find a means to identify the path of the OS drive without a degree of sloppiness and in all environments. So far the only two means I know of are like so: 1.) Works so long as the home path resides on the same drive the OS does. Useless to me in my work environment. $dir = @HomeDrive MsgBox(0,"",$dir) 2.) Works for the most part, but really sloppy. Becomes a pain when having to use the path literally in comparisons or when treated as a string for StringCompare() functions since it needs to be sanitized of the workaround addition in the path before use. $dir = @WindowsDir & '\..' FileChangeDir($dir) $dir = @WorkingDir MsgBox(0,"",$dir) Of course FileChangeDir() doesn't need to be used. It just produces quick viewable results to describe my problem. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted May 30, 2011 Share Posted May 30, 2011 What if you grab the first three chars with StringLeft? $sWindowsDir = StringLeft(@WindowsDir, 3) MsgBox(0, "", $sWindowsDir) Gives the same result as your script in half the lines .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Sn3akyP3t3 Posted May 31, 2011 Author Share Posted May 31, 2011 What if you grab the first three chars with StringLeft? $sWindowsDir = StringLeft(@WindowsDir, 3) MsgBox(0, "", $sWindowsDir) Gives the same result as your script in half the lines Thanks! Leave it to me to over-analyze the simple stuff! Link to comment Share on other sites More sharing options...
MHz Posted May 31, 2011 Share Posted May 31, 2011 (edited) EnvGet() is also handy to know if you want to use values from environmental variables. $systemdrive = EnvGet('SystemDrive') MsgBox(0, '$systemdrive', $systemdrive) Edit: fixed typo Edited May 31, 2011 by MHz Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now