Why "d:\0.0" doesn't substring of "D:\0.0" while using "findstr" command of Windows command prompt

StackOverflow https://stackoverflow.com/questions/21876543

  •  13-10-2022
  •  | 
  •  

문제

I'm using "findstr" command with case-insensitive option (/I flag),
and I can't explain the results below.

echo "D:\0.0" | findstr /I "d:\0"

Output: "D:\0.0"

echo "D:\0.0" | findstr /I "d:\0.0"

Output:


why "d:\0.0" doesn't substring of "D:\0.0"?

도움이 되었습니까?

해결책

Because you are searching for a regexp rather than a substring:

>echo "D:\0.0" | findstr /I "D:\0.0"

gives nothing either. You want to add the literal flag /l

>echo "D:\0.0" | findstr /I /l "d:\0.0"

gives:

"D:\0.0"

If you want to use the regexp, you need to escape the dot

>echo "D:\0.0" | findstr /I "d:\0\.0"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top