This is the code I'm running:
RunWait("ComSpec & " /c Start 'D:\Program Files (x86)\Pidgin\pidgin.exe'")
I have also tried without semiquotes and with quotes but then I get syntax errors.
This is the code I'm running:
RunWait("ComSpec & " /c Start 'D:\Program Files (x86)\Pidgin\pidgin.exe'")
I have also tried without semiquotes and with quotes but then I get syntax errors.
The problem is that the file path on your computer has spaces in it and needs double-quotations around it.
Try "D:\Program Files (x86)\Pidgin\pidgin.exe" from the command prompt with the double-quotations and make sure the program starts.
Once you know it works you can add it to your AutoIt code like so (notice that it is surrounded by single-quotations).
RunWait(@ComSpec & " /c " & '"D:\Program Files (x86)\Pidgin\pidgin.exe"')
In AutoIt, you can escape quotes simply by repeating them (same way it happens on Batch/DOS):
RunWait(@ComSpec & " /c ""Start D:\Program Files (x86)\Pidgin\pidgin.exe""")
It looks like a problem with the amount of quotes in your code. I would do something like this:
(RunWait(@ComSpec & " /c Start" & "D:\Program Files (x86)\Pidgin\pidgin.exe")
As per Documentation - FAQ - Double quotes:
If you want to use double-quotes inside a string then you must "double them up". So for every one quote you want you should use two. ...
or use single quotes instead ...
Examples:
RunWait(@ComSpec & " /c " & """D:\Program Files (x86)\Pidgin\pidgin.exe""")
RunWait(@ComSpec & ' /c ' & '"D:\Program Files (x86)\Pidgin\pidgin.exe"')
However, there is no need for the "SPECified secondary COMmand interpreter" (or @ComSpec
), nor escaping of double-quotes. Example:
Global Const $g_sFile = "D:\Program Files (x86)\Pidgin\pidgin.exe"
Run($g_sFile, "")
You have an unmatched "
in the middle.
Usually / or \ are used for escaping. Try /" or \" because I'm not sure which of both works with AutoIt.