when i run the following code
echo computer hope >> mystr.txt
findstr "Computer hope" mystr.txt > x.txt
set /p mystr=<x.txt
If %mystr%=="Computer hope" (
echo mystr=%mystr%
goto :end
)
echo string does not exist
:end
I get the error as
"hope was unexpected at this time."
I need to compare computer hope
thanks
C:\test>type dis1.bat
@echo off
echo "computer hope" > mystr.txt
echo nonsense >> mystr.txt
rem echo computerhope >> mystr.txt
findstr "computer hope" mystr.txt > x.txt
set /p mystr=<x.txt
If %mystr%=="computer hope" (
echo mystr=%mystr%
goto :end
)
echo string does not exist
:end
C:\test>dis1.bat
mystr= "computer hope"
C:\test>
tinkuy ,
echo computer hope >> mystr.txt
echo "computer hope" >> mystr.txt
use quotes on above input