Jump to content

Run exe in command line with environment variable


pintas
 Share

Recommended Posts

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)
Link to comment
Share on other sites

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)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...