Mecano Posted November 17, 2007 Share Posted November 17, 2007 (edited) Hallo forum members I've found a nice tool SmithTech DriveVar Usage: drivevar.exe (will open the form window to set the drive variable to %PA_DRV% drivevar.exe -a (will set the drive variable with out opening the window) drivevar.exe -d (will remove the drive variable) DriveVar is useful for running applications from a usb drive where the drive letter may change. It will set a system environment variable of %PA_DRV% to the drive letter of your usb drive. You can use this variable in place of the drive letter in shortcuts, ini files, config files, etc. If you use start / end scripts with your usb drive to set other parameters, you can add drivevar.exe to your scripts with the " -a" or " -d" argument to add or remove the variable. drivevar.exe also works with PStart's on startup and on exit option. works fine from a batch file drivevar.exe -a start /wait %PA_DRV%\PortableApps\WinRAR\WinRAR.exe drivevar.exe -d but I cant get it running with AutoIt Run("drivevar.exe -a") RunWait("%PA_DRV%\PortableApps\WinRAR\WinRAR.exe") Run("drivevar.exe -d") Exit no luck I've tried this: Run("drivevar.exe -a") Dim $var $var = "%PA_DRV%" RunWait($var & '\PortableApps\WinRAR\WinRAR.exe') Run("drivevar.exe -d") Exit can someone put me in the right direction? Regards, Mecano Edited November 17, 2007 by Mecano Link to comment Share on other sites More sharing options...
Jex Posted November 17, 2007 Share Posted November 17, 2007 Maybe you can use _RunDOS function? My scripts : Immediate Window , My Web Browser , Travian , Text Effect , Characters & Words per minute or second , Image Editor (ImageMagick) , Matrix style background effect ( Screensaver ) , Mail Sender , Protectlinks decoder and Rapidshare links checker , Fonts Fetcher , Region determine , Compare pictures , Gradient color box , Mouse Coordinates, Colors, Pixel Search things , Encrypt/Decrypt and embeding file in jpeg thing , Hard disk space monitor , Reflex game , Multiplayer Tic Tac Toe , WLM ( MSN ) personal message changer Link to comment Share on other sites More sharing options...
Danny35d Posted November 17, 2007 Share Posted November 17, 2007 To get the value of PA_DRV use EnvGet() $var = EnvGet("PA_DRV")Also at the run() and runwait() function I will add the working directory.Run("drivevar.exe -a", @ScriptDir)Note:You don't even need drivervar.exe in autoit you can use this line instead:$var = StringMid(@ScriptDir, 2)will do the same thing as drivervar.exe without setting a system environment variable AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Mecano Posted November 17, 2007 Author Share Posted November 17, 2007 (edited) Wow awesome what you can do with Autoit Both Works perfect but off course I gone use $var = StringMid(@ScriptDir, 2) On U3 drives the EnvGet() works great as well $var = EnvGet("U3_HOST_EXEC_PATH") Thanx for repley Regards, Mecano Edited November 18, 2007 by Mecano 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