invoke program from CMD, with path contains white space

1

C:\Documents and Settings\js>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_11

C:\Documents and Settings\js>cd  %JAVA_HOME%\bin

C:\Program Files\Java\jdk1.6.0_11\bin>%JAVA_HOME%\bin java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

How to solve this white space problem?

janetsmith

Posted 2009-09-22T23:08:09.667

Reputation:

This windows command prompt is not DOS, you are not running this in a DOS environment. – None – 2009-09-22T23:18:04.677

Answers

5

Use quotation marks:

cd "%JAVA_HOME%\bin"
"%JAVA_HOME%\bin\java" 

Tony Miller

Posted 2009-09-22T23:08:09.667

Reputation: 211

1

If the "Java" is an application you must do this to run.

"%JAVA_HOME%\bin\"Java

or

"%JAVA_HOME%\bin\"Java.Exe

RRUZ

Posted 2009-09-22T23:08:09.667

Reputation: 232