spaces in paths

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
keyboard1333a

spaces in paths

#1 Post by keyboard1333a » 10 Dec 2011 17:17

I'm trying to test to see if a directory exists

Code: Select all

echo off
cls
IF EXIST C:\Documents and Settings\Owner\Desktop\New Folder (
echo exists
) ELSE (
echo does not exist
)
pause

but it dosn't like the spaces in the path (C:\Documents and Settings\Owner\Desktop\New Folder )

Is there a way aroung this.
Thanks Keyboard1333 :lol:

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: spaces in paths

#2 Post by Ed Dyreen » 10 Dec 2011 18:05

'

Code: Select all

echo off
cls
IF EXIST "C:\Documents and Settings\Owner\Desktop\New Folder" (
echo exists
) ELSE (
echo does not exist
)
pause
" :twisted: "

keyboard1333a

Re: spaces in paths

#3 Post by keyboard1333a » 10 Dec 2011 18:15

I don't understand. The code you posted is exactly the same as the original. How is that to help. Unless you mean the ' at the top of your post. Please try to clarify your reply a bit.

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: spaces in paths

#4 Post by dbenham » 10 Dec 2011 19:48

Look again...

... Ed's code has quotes around the path

Post Reply