4

I'm new to AutoHotkey and cannot understand why this script is giving me the error:

 Failed to launch program or document
 Action: <C:\Windows\System32\msg.exe>
 Params: <* "Initiated.">
 Specifically: The system cannot find the file specified.

Here is the simple script in my test.ahk file:

Run, "C:\Windows\System32\msg.exe" * "Initiated."

I've verified that the msg.exe file is in the c:\Windows\System32 folder and I can run it without the script from both a command prompt and by clicking on the msg.exe program. I can also create a shortcut for msg.exe and it works, but I cannot figure out how to get the test.ahk script file to see it.

I tried running the script (by clicking on the test.ahk file), as Administrator but get the same error.

ciso
  • 2,887
  • 6
  • 33
  • 58

1 Answers1

6

That path gets redirected to C:\Windows\SysWOW64 for 32-bit programs.

Try changing the path in your script to "C:\Windows\SysNative\msg.exe"

Or better yet, don't put non-system files in directories owned by the OS.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • 1
    I'm pretty sure the OP means [this msg.exe](http://ss64.com/nt/msg.html). At least in Windows 7 Enterprise, it's only distributed as a 64-bit program in System32; there's no 32-bit build in SysWow64. – Eryk Sun Mar 01 '15 at 21:05
  • 1
    @ChrisGciso, apparently AutoHotkey is a 32-bit program, for which accessing the System32 directory gets redirected to SysWow64, as Ben already explained. – Eryk Sun Mar 01 '15 at 22:22
  • Btw, the reason I use the 32bit autokey.exe is for compatibility reasons so that people with a 32bit O/S can run my scripts. Autokey tells me that if I use the 64 bit version, those 64 bit compiled scripts won't run on 32 bit systems. – ciso Mar 01 '15 at 22:29
  • 1
    What's autokey.exe? You can compile AutoHotkey scripts for 32-bit systems while using AutoHotkey 64-bit on your own system. Just select a 32-bit option from the "Base File" drop-down in the compiler. – Lexikos Mar 02 '15 at 11:15
  • 1
    @ChrisGciso I had a similar problem with autohotkey, could not start a program located in `c:\windows\system32`. Changing it to `c:\windows\sysnative` helped - Now that's really interesting, how windows does that directory renaming for compatibility reasons! – SQL Police Nov 11 '15 at 17:00