Jump to content
Sign in to follow this  
tonysathre

Expanding %1

Recommended Posts

tonysathre

I have a batch script that I put in my SendTo folder so I can mount disc images by right-clicking them, and selecting the SendTo item, using Daemon Tools. This works fine, but it opens up a console window for a couple seconds while it mounts. I wanted to replace it with an AutoIT script so that window won't pop up.

I am using the Opt() ExpandEnvStrings.

The Run() function doesn't seem to expand %1 to the patch of the image file.

Run("%programfiles%\Daemon Tools\daemon.exe -mount 0,%1")

When I point an image file to this script, I get a dialog box from Daemon Tools that says that it could not find the image file.

Any help is appreciated.

Thanks,

Tony

Share this post


Link to post
Share on other sites
weaponx

Run(@ProgramFilesDir & "\Daemon Tools\daemon.exe -mount 0," & $CmdLine[1])

Share this post


Link to post
Share on other sites
tonysathre

I tried this:

Run("%programfiles%\Daemon Tools\daemon.exe -mount 0," $CmdLine[1])

I didn't know I needed the &.

Thanks

Share this post


Link to post
Share on other sites
tonysathre

I tried what you suggested and it didn't work. I got the same error message stating that; "Unable to mount image file. Unable to access image file."

Opt("ExpandEnvStrings" , 1)
Run(@ProgramFilesDir & "\Daemon Tools Lite\daemon.exe -mount 0," & $CmdLine[1])

Any other ideas?

Thanks,

Tony

Share this post


Link to post
Share on other sites
weaponx

Run(@ProgramFilesDir & "\Daemon Tools Lite\daemon.exe -mount 0," & $CmdLine[1], @ProgramFilesDir & "\Daemon Tools Lite")

Share this post


Link to post
Share on other sites
tonysathre

That didn't work either. I did however get it to work with this:

Opt("ExpandEnvStrings" , 1)
$Var1 = $cmdline[1]
run('"c:\program files\Daemon Tools Lite\daemon.exe" -mount 0,"' & $var1 &'"')

I found this by searching the forum, which I should have done in the first place. Thanks for your help.

Tony

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  

×