Hi All,
I suspect the answer to this would be (fairly) simple for an experienced
batch file writer - but because I am using the 'for' command (the syntax
of said command I'm sure was originally written in Swahili !) I'm having
a few problems :-(
I have a variable (%VariName%) which contains a fully qualified
path.filename.ext string. eg: D:\Path1\Path2\File Name.ext
I want to recover the JUST the extension into a new variable (%FileExt%).
Currently I'm using:
for /f "tokens=2 delims=." %%a in ('echo %VariName%') do set FileExt=%%a
(probably wrapped but actually 1 line :-) )
This works, but will of course fails if there are any '.' characters
within the path or filename areas of the variable (because of the
'tokens=2')
I note that the syntax of the 'for' command has been expanded with new
%~x parameters which supposedly allow extraction of specific parts of
fully qualified filename - but I'm at a total loss trying to decipher
how to do so :-(
TSCMD seems to be reasonably silent on this issue - the couple of
references I found to it really didn't help explain the syntax or use.
Could somebody be so kind as to enlighten me - or suggest an alternate
9simpler) approach to the problem.
Calvin.