For /F and set (Solved)
Posted: 31 May 2012 16:41
Windows XP script.
RESSTRING is a string
RESLIST is a file
Within a script I have:
for /f "delims=" %%a in ('findstr "%RESSTRING%" %RESLIST%') do @set RESLINE=%%a
echo %RESLINE%
The set command doesn't work as I expect it to.
echo %RESLINE% is empty.
echo %%a returns the expected sting (when I replace "@set RESLINE=%%a" with "echo %%a".
The same command executed at the command line works fine.
for /f "delims=" %a in ('findstr "%RESSTRING%" %RESLIST%') do @set RESLINE=%a
echo %RESLINE% returns the expected sting.
echo %%a returns the expected sting.
Any help would be appreciated.
RESSTRING is a string
RESLIST is a file
Within a script I have:
for /f "delims=" %%a in ('findstr "%RESSTRING%" %RESLIST%') do @set RESLINE=%%a
echo %RESLINE%
The set command doesn't work as I expect it to.
echo %RESLINE% is empty.
echo %%a returns the expected sting (when I replace "@set RESLINE=%%a" with "echo %%a".
The same command executed at the command line works fine.
for /f "delims=" %a in ('findstr "%RESSTRING%" %RESLIST%') do @set RESLINE=%a
echo %RESLINE% returns the expected sting.
echo %%a returns the expected sting.
Any help would be appreciated.