amosko Posted February 5, 2014 Posted February 5, 2014 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.
orbs Posted February 5, 2014 Posted February 5, 2014 (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 February 5, 2014 by orbs Signature - my forum contributions: Spoiler UDF: 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 Apps: 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now