R
Ronny
Suppose I have a variable FILE which contains the full path to a file.
To store the name of the directory where this file is stored, I use in
my batch file the following assignment:
for %%F in ("%FILE%") do set DIR=%%~dpF
This works, but %DIR% contains the directory name with a trailing
backslash
added. Is there an easy way to get the directory name WITHOUT the
backslash?
For instance, if FILE is \\share\c:\foo\bar\baz.txt, I would like DIR
to contain
\\share\c:\foo\bar and not \\share\c:\foo\bar\
To store the name of the directory where this file is stored, I use in
my batch file the following assignment:
for %%F in ("%FILE%") do set DIR=%%~dpF
This works, but %DIR% contains the directory name with a trailing
backslash
added. Is there an easy way to get the directory name WITHOUT the
backslash?
For instance, if FILE is \\share\c:\foo\bar\baz.txt, I would like DIR
to contain
\\share\c:\foo\bar and not \\share\c:\foo\bar\