Jump to content

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.

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

Signature - my forum contributions:



LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates


Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff


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

  • Recently Browsing   0 members

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