Jump to content
Sign in to follow this  
pintas

Run exe in command line with environment variable

Recommended Posts

pintas

I'm trying to run a custom exe in command prompt using a environment variable, but when i use "" it simply doesn't work.

The dos program i'm using needs double quotes to work with files.

Can anyone help me out please?

Here's the script i'm trying to get working:

Run('prog.exe copy "%appdata%\file.txt" -param',"",@SW_HIDE)

Share this post


Link to post
Share on other sites
azure

I'm trying to run a custom exe in command prompt using a environment variable, but when i use "" it simply doesn't work.

The dos program i'm using needs double quotes to work with files.

Can anyone help me out please?

Here's the script i'm trying to get working:

Run('prog.exe copy "%appdata%\file.txt" -param',"",@SW_HIDE)
Double Quotes? like this?

Run('prog.exe copy ""%appdata%\file.txt"" -param',@SYSTEMDIR,@SW_HIDE)

Share this post


Link to post
Share on other sites
pintas

No, i mean like this: "%appdata%\file.txt"

Autoit needs the "" to work so that variable inside is completetly disregarded. :)

In the command prompt it would look like exactly like this what i'm trying to accomplish via autoit:

C:\> prog.exe copy "%appdata%\file.txt" -param
Edited by pintas

Share this post


Link to post
Share on other sites
cramaboule

I'm trying to run a custom exe in command prompt using a environment variable, but when i use "" it simply doesn't work.

The dos program i'm using needs double quotes to work with files.

Can anyone help me out please?

Here's the script i'm trying to get working:

Run('prog.exe copy "%appdata%\file.txt" -param',"",@SW_HIDE)
1. Look under ShellExecute()

Run() can Only execute EXE, BAT, COM, or PIF

2. %appdata% -> $myvar&"file.txt" (@AppDataDir&"file.txt" or @AppDataCommonDir&"file.txt" as well !)

Cram...

Share this post


Link to post
Share on other sites
pintas

Somehow with the '@SYSTEMDIR' it just doesn't work. The program doesn't run. If i remove the @SYSTEMDIR, the program runs, but it doesnt understand the command.

I didn't quite understand it... should i copy the proggy.exe to the systemdir?

Any other way to do it?

Thanks for your help :)

Edited by pintas

Share this post


Link to post
Share on other sites
azure

Somehow with the '@SYSTEMDIR' it just doesn't work. Nothing happens.

I didn't quite understand it... should i copy the proggy.exe to the systemdir?

Any other way to do it?

Thanks for your help :)

Oh... well no. you can change it to @SCRIPTDIR if prog.exe is in the same directory as your script. That's the working directory. I just use @SYSTEMDIR as a filler if the program I'm running is in the system path (accessible from anywhere).

Share this post


Link to post
Share on other sites
pintas

LOL. I forgot to try that.

It works beautifully!

If i was gay i would kiss you. LOL

Thanks man :)

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  

×