I tried to find the solutions in many places but couldn't find specific answer.
I am creating a batch script. The following is my code so far
@echo off
SETLOCAL EnableDelayedExpansion
cls
for /f "delims=" %%a in ('rasdial EVDO cdma cdma') do set "ras=!ras! %%a"
findstr /C:"%ras%" "already"
if %errorlevel% == 0
(
echo "it says he found the word already"
)
else
(
echo "it says he couldn't find the word already"
)
OUTPUT :
FINDSTR: Cannot open already
The syntax of the command is incorrect.
I'm trying to find the word 'already' in variable 'ras',
The problem seems to be in findstr /C:"%ras%" "already"
I tried using findstr "%ras%" "already" but that doesn't work too.
Seems I already found the solution..
echo %ras% | findstr "already" > nul
and @Karata I can't use
rasdial EVDO cdma cdma | findstr already > NUL
because I am writing script for multiple cases and I want to store output in a variable..Thanks anyways.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With