FOR command - help please
Posted: 04 May 2010 10:48
Hi
I have a file temp.txt with the following string content
C:\folder\file1.txt
I need to extract the string file1.txt from temp.txt and store the value in a variable. I did this using a batch script with the following commands
set "DirPath=C:\folder\"
for /f "tokens=* delims=%DirPath%" %%a in (temp.txt) do echo %%a
I just get the string "xt" output and not file1.txt. What am I doing wrong?
I am assuming that the delimiter is C:\folder\ and that should give %%a as file1.txt
Any help will be greatly appreciated.
I have a file temp.txt with the following string content
C:\folder\file1.txt
I need to extract the string file1.txt from temp.txt and store the value in a variable. I did this using a batch script with the following commands
set "DirPath=C:\folder\"
for /f "tokens=* delims=%DirPath%" %%a in (temp.txt) do echo %%a
I just get the string "xt" output and not file1.txt. What am I doing wrong?
I am assuming that the delimiter is C:\folder\ and that should give %%a as file1.txt
Any help will be greatly appreciated.