I am reading a text file %tmp%\tmp.txt. I am trying to find a line with a given string (in this example "RemotePath") and it sets the variable netdrive to that line if it is found. Here is my code:
for /f "tokens=*" %%a in (%tmp%\tmp.txt) do echo.%%a|findstr /C:"RemotePath " >nul 2>&1 && set netdrive=%%a
It never sets netdrive to anything, however when i change the set netdrive=%%a
to echo %%a >> netdrive.txt
the text I want does come up in the text file. Any ideas?