Parsing a line with quotes

Pretend I have a file called c:\temp\file.ps1 and on one of the lines I have:

$version=“1”

How do I code relevance that says does exist?

I tried below.

Contents of file are:

image

How does one escape the quotes?

Try this:

Q: exists line whose (it as string contains "$version=%221%22") of file "C:\Users\vkhurava\Downloads\co020.txt"
A: True

You need to use URL encoding for your internal double quotes which resolve as %22.

3 Likes