Jump to content
Sign in to follow this  

Help with run(*.exe)

Recommended Posts


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


I've tried also doing

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


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

I'm not sure what the right syntax is.

Share this post

Link to post
Share on other sites

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.