Jump to content
Sign in to follow this  
Mecano

Drive Variable

Recommended Posts

Mecano

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 by Mecano

Share this post


Link to post
Share on other sites
Jex
Danny35d

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

Share this post


Link to post
Share on other sites
Mecano

Wow awesome what you can do with Autoit :P

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 by Mecano

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×