Select-string escape character

Question:

I’m trying to search directory c:\bats\ for batch files containing the unc path \\server\public

Command:

I receive an error related to the string \\server\public:

I’ve tried using various escapes such as "\server\public" or "'\server\public'" but I always receive that same error.

Answer:

Try this using single quotes around your search string and specifying SimpleMatch.

Source:

Select-string escape character by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply