Dos batch script not working: Spaces in path

February 9, 2011 at 03:45:57
Specs: Windows XP
set RF_PROPERTIES="%ARCOT_HOME%\conf"
dir %RF_PROPERTIES%
if not exist %RF_PROPERTIES%
goto NO_RF_PROPERTIES

The ARCOT_HOME variable above has spaces. The dir command works and lists the files, but the if command fails with "The syntax of the command is incorrect.". Is there a way to make it work?


See More: Dos batch script not working: Spaces in path

Report •


#1
February 9, 2011 at 04:00:48
Not DOS but try enclosing in double quotes.

C:\>if exist "Program Files" echo y
y


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
February 9, 2011 at 04:15:19
How does that help me? I can't hardcode the path, it can be set to any value.

Report •

#3
February 9, 2011 at 05:04:42
DQ.BAT /A NP L 10 C 1 Ins vt
:: ==========================================
::
:: dq.bat Wed 09-02-2011 19:54:53.67
@echo off & setLocal enableDELAYedeXpansion

pushd c:\
set PF=Program Files
if exist "%PF%\Java" echo yep


=====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions


Ask Question