1.

Solve : string parsing (with batch)?

Answer»

Hello,

I have a PATH in a variable and WANT only the file / folder name, not the whole path.

example:
-iso c:\folder\folder\file name

output should be: file name

The problem is I can`t work with spaces as delimeter cause sometimes folder and filenames are with spaces.
The number of subfolders differs.
Is there MAYBE a trick to filter out the token after the last \?

thanks in advance for any help
uliQuote

Hello,

I have a path in a variable and want only the file / folder name, not the whole path.

example:
-iso c:\folder\folder\file name

output should be: file name

The problem is I can`t work with spaces as delimeter cause sometimes folder and filenames are with spaces.
The number of subfolders differs.
Is there maybe a trick to filter out the token after the last \?

thanks in advance for any help
uli

The for loop help explains that %~nI expand %I to file name. For more info, type for /?. Maybe its want you want.I think ghostdog is right. You probably want %%~na%%~xa (assuming your variable is %%a in a FOR loop)
You will have to give more details or POST your code if you NEED more help.thats it.
I should learn to work with qualifiers.

Many thanks :-)

uli




Discussion

No Comment Found