I have a string %str%=c:\parentdir\childdir\filename.ext
I wont know in advance the length of parentdir,childdir, or filename nor will i know the drive letter
How can i break this out into
c:
c:\parentdir
c:\parentdir\childdir
filename.ext
Thanks,
Parse path into drive/directory/file
Moderator: DosItHelp
Hi jpeg,
look at the help of FOR (for /?), there is the substitution explained.
Results to
jeb
look at the help of FOR (for /?), there is the substitution explained.
Code: Select all
setlocal
set str=c:\parentdir\childdir\filename.ext
call :split %str%
goto :eof
:split
echo drive=%~d1 path=%~p1 name=%~n1 ext=%~x1
goto :eof
Results to
Code: Select all
drive=c: path=\parentdir\childdir\ name=filename ext=.ext
jeb
Re: Parse path into drive/directory/file
hello,
how to put in a variable only this directory "childdir" ?
Regards
how to put in a variable only this directory "childdir" ?
Regards
Re: Parse path into drive/directory/file
Start a new thread - don't reopen old threads.
Explain your request a little better too.
Explain your request a little better too.