I'm trying to run an executable from the command line. Here is the full path to the .exe:

C:\Program Files\R\R-3.0.2\bin\Rscript.exe

So, the command I type into the command line to open this .exe is:

"C:\Program Files\R\R-3.0.2\bin\Rscript.exe"

This works fine on my PC, but on another PC double quotes do not seem to work when dealing with file names that include spaces. I get the following error on that PC:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

How can I resolve this problem?

This is on Windows 7.

  • open the command prompt on the computer where it does not work and start to type the command with full path and use the TAB key to see to what it will resolve and use the resulting full path with exe name. Meaning, type c:\prog and press TAB until you get the correct top directory, type ` or \R` and continue with the TAB key until you reach the correct exe. Then copy the result and try to paste/run it in another window to make sure works. Are you running it directly in command prompt or in a cmd /c session or in a batch? You could try double-double quoting it ""c:\Program Files"" – Zina Mar 31 '16 at 16:38

Have a look at this.

Check for the existence of these registry keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

These are AutoRun commands which are executed every time the cmd is executed. Neither one should exist.

  • Please comment if you downvote. – duenni Apr 1 '16 at 7:42
  • This is a fringe case, if any, and has nothing to do with the OP's spaces-in-args question. – Sinus Mackowaty Dec 11 '19 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.