Sign in to follow this  
Followers 0
amosko

Help with run(*.exe)

2 posts in this topic

I am attempting to use the run() function to open a program I would like to launch. I simply type:

run("NameofProgram.exe")

I've tried also doing

run("NameofProgram.exe", "@Programfiles(x86)")

and

run("NameofProgram.exe", "%Programfiles(x86)%")

I'm not sure what the right syntax is.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hello amosko, welcome to AutoIt and to the forum!

when you use macro - the @stuff - you do not enclose it in quotes. if you do, then AutoIt considers it literally as a string. the help file example of Run() shows you exactly this.

to get access to environment variables, use EnvGet(), again with quotes where should be, without the % signs.

also you probably need to specify the directory where the program is installed (a sub-folder of the Program Files):

also, you can just put the full path of the exe. again, this is shown in the help file example.

 

try these options:

Run("NameOfProgram.exe", EnvGet("ProgramFiles(x86)") & "\ProgramSubfolder")

Run(EnvGet("ProgramFiles(x86)") & "\ProgramSubfolder\NameOfProgram.exe")

note that the %ProgramFiles(x86)% environment variable exists only for 64-bit Windows, so this will fail in 32-bit.

Edited by orbs

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  
Followers 0