2

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.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Wolfpack'08
  • 3,982
  • 11
  • 46
  • 78

5 Answers5

5

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"')
MrAutoIt
  • 785
  • 6
  • 21
3

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""")
1

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")
user4157124
  • 2,809
  • 13
  • 27
  • 42
Pear666
  • 53
  • 9
0

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, "")

Related.

Community
  • 1
  • 1
user4157124
  • 2,809
  • 13
  • 27
  • 42
-1

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fookiee
  • 156
  • 1
  • 12