Searching string with "\" charachter in powershell
Dear all ,
Hope you are well. I need to comb through a bunch of folders containing config files and find all files that contain a reference of specific string that has "\" in it using powershell. This is what am running ...
Get-ChildItem -Path d:\config -recurse | Select-String -Pattern "cygdrive\c"| Export-Csv D:\otests.csv
I get this error message :
Select-String : parsing "cygdrive\c" - Missing control character.
At line:1 char:68
+ Get-ChildItem -Path d:\config -recurse | Select-String <<<< -Pattern "cygdrive\c"| Export-Csv D:\results.csv
+ CategoryInfo : NotSpecified: (:) [Select-String], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.SelectStringCommand
Now I am aware of escape charachters in powershell , however I think for this I need to use regex command which am not at all familiar with. Can anyone please advise?
1 Comment
[ + ] Show comment
-
Boom indeed! Many thanks kind sir. That did it. - TonyFishers 7 years ago
Answers (1)
Answer Summary:
Please log in to answer
Posted by:
rileyz
7 years ago