1.

Solve : REMOVAL of file path from DOS variable?

Answer»

hi, sorry if this has been ASKED and answered before, im terrible at searching forums

i need to remove the filepath from a dos variable  which is passed on the command line  eg

dosapp.bat C:\blabla\bla bla bla\filename.ext 

INSIDE dosapp.bat  %1  will be C:\blabla\bla bla bla\filename.ext

how can i PARSE that to make a second variable just  filename.ext


ive just tried for about an hour using the FOR command  and %%_nx etc
but no joy,  does anyone have a nice ELEGANT solution ?

thanks in advance You have the right idea. I think your error was the underscore instead of a squiggle:

Code: [Select]echo off
for /f %%V in ("%1") do echo %%~nxV

Good luck.



Discussion

No Comment Found