December 27th, 2006, 11:16 AM
Finding last token in batch file
I have a batch file which gets a full path name as an argument. I want just the name of the last folder in that path and this regardless of path depth.
I've been trying things like this:
but don't seem to find a way to access only the last token.
for /f "tokens=2* delims=\" %%a in (%1) do echo %%a
December 27th, 2006, 02:29 PM
for %%a in (%1) do echo %%~nxa
Nobody is perfect. I am Nobody.
December 28th, 2006, 02:54 AM
That works, thx!!!
Originally Posted by LaughingBelly