S
Stephen Quist
Hi,
I'm trying to write a little command file to see if all the
directories in a PATH exist. I've run across a problem
with spaces in path names.
If I just check the path statement I get a list of names
separated with semicolons:
PATH=c:\perl\bin;c:\cygwin\bin;C:\PROGRA~1\MKSTOO~1\bin;...
This includes elements like this:
C:\Program Files\Common Files\Adaptec Shared\System; with embedded spaces.
When I use PATH in a for statement,
for %%p in (%path%) do (
echo %%p
)
The semicolons get converted to spaces:
for %p in (c:\perl\bin c:\cygwin\bin C:\PROGRA~1\MKSTOO~1\bin
so that when I get to the directory names that do contain spaces
I get what you'd expect, but not what I want:
C:\stuff>(echo C:\Program )
C:\Program
C:\stuff>(echo Files\Common )
Files\Common
C:\stuff>(echo Files\Adaptec )
Files\Adaptec
C:\stuff>(echo Shared\System )
Shared\System
Has anyone here already solved this little problem?
Thanks
Steve
I'm trying to write a little command file to see if all the
directories in a PATH exist. I've run across a problem
with spaces in path names.
If I just check the path statement I get a list of names
separated with semicolons:
PATH=c:\perl\bin;c:\cygwin\bin;C:\PROGRA~1\MKSTOO~1\bin;...
This includes elements like this:
C:\Program Files\Common Files\Adaptec Shared\System; with embedded spaces.
When I use PATH in a for statement,
for %%p in (%path%) do (
echo %%p
)
The semicolons get converted to spaces:
for %p in (c:\perl\bin c:\cygwin\bin C:\PROGRA~1\MKSTOO~1\bin
so that when I get to the directory names that do contain spaces
I get what you'd expect, but not what I want:
C:\stuff>(echo C:\Program )
C:\Program
C:\stuff>(echo Files\Common )
Files\Common
C:\stuff>(echo Files\Adaptec )
Files\Adaptec
C:\stuff>(echo Shared\System )
Shared\System
Has anyone here already solved this little problem?
Thanks
Steve