goaliepride Posted March 2, 2011 Posted March 2, 2011 (edited) I'm new to powershell, but am trying to evaluate a statement and getting results I don't understand. I find that my variable = True. Then when I write an if statement to evaluate if something is "True" I get a yes answer. PS U:\> $pathexists True PS U:\> if ($pathexists -eq "True") {"It was True"} It was True PS U:\> if ($pathexists -eq "False") {"It was also False!"} It was also False! PS U:\> $pathexists True Why in the world would ($pathexists -eq "False") wind up evaluating as if they were equal, when my variable is clearly True? Edited March 2, 2011 by goaliepride fixed
goaliepride Posted March 2, 2011 Author Posted March 2, 2011 This wound up being a problem of statements I think. true/false should be written $true/$false, who knew something that looked like a variable was a constant?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now