Hi,
I receive a file that contains the following:
\direcotry1\directory2\directory3\file1
\direcotry1\file2
\direcotry1\directory2\directory3\directory4\file3
\direcotry1\file4
\direcotry1\directory2\file5
file6
The amount of files in the file and the amount of directories are variable.
What I need is the path only.
\direcotry1\directory2\directory3\ for file1
\direcotry1\ for file2
\direcotry1\directory2\directory3\directory4\ for file3
\direcotry1\ for file4
\direcotry1\directory2\ for file5
and nothing for file6
I used the variable %%~pi which works for all except for the last one. For the last one it returns \cft\
I guess the \cft\ is returned as the program that is calling the bat file launches it from there.
FOR /F %%i in (test.txt) DO (
echo %%~pi
command1
command2
)
Does anyone know how I can avoid that the batfile returns \cft\? I want the bat to return nothing when there's no path.
Thanks a lot in advance for your help.