That's a relative path, I'd assumed it was clear I was supplying a
means
of identifying an absolute path.
--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l
Dean Wells (MVP) wrote:
For validity, use an 'if exist'. To determine whether a
supplied
path is relative or absolute, verify that one of the following
is
true -
1. the second and third characters are a colon and backslash
respectively
2. the first character is a backslash
How about
..\uponefolder\siblingfolder
?
by the way , could i analyze a literal string char by char ? seems
for
loop could only process token by token
Here's one way I can think of to parse a string ...
@echo off
set "string=%~1"
set "n="
:loop
if not defined string goto :EOF
set /a n+=1
set "char=%string:~0,1%"
set "string=%string:~1%"
echo %n% %char% %string%
goto loop
I thought if I knew the length of the string, it could also be done in
a FOR /L statement, but I couldn't find a good solution to the 'find
the length' problem in a google search. So, I constructed this
one ...
@echo off
echo.|set /p "x=%1" > %temp%\tmp.txt
for %%a in (%temp%\tmp.txt) do set Length=%%~za
del %temp%\tmp.txt
echo %Length%
So with the length the FOR parsing goes something like this ...
@echo off
echo.|set /p "x=%1" > %temp%\tmp.txt
for %%a in (%temp%\tmp.txt) do set /a c=%%~za-1
del %temp%\tmp.txt
set "string=%~1"
for /l %%a in (0,1,%c%) do call echo %%a %%string:~%%a,1%%
The looping solution seems a tiny bit more useful to me, but ...
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/