Reputation: 1793
If I run from cmd.exe:
findstr "\"A\" : \"B\"" c:\temp\sample.json
echo %errorlevel%
with the contents of sample.json being
{
"Abad" : "B"
}
errorlevel shows as 0.
If I replace ':' with '.', I again get 0. But, if I instead use two '.'s:
findstr "\"A\" ..\"B\"" c:\temp\sample.json
findstr correctly returns an errorlevel of 1. What is findstr trying to do?
Upvotes: 0
Views: 1150
Reputation: 80043
RTFM.
With a space between strings, FINDSTR looks for string1 OR string2 OR string3...
Your FINDSTR
is thus looking for "A"
OR :
OR "B"
To look for a string containing spaces, use (eg)
findstr /c:"\"A\" : \"B\""
Upvotes: 3