+ Post New Thread
Results 1 to 2 of 2
Windows Thread, PowerShell truth evaluation statement (Fixed) in Technical; I'm new to powershell, but am trying to evaluate a statement and getting results I don't understand. I find that ...
  1. #1
    goaliepride's Avatar
    Join Date
    Feb 2008
    Posts
    47
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    PowerShell truth evaluation statement (Fixed)

    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?
    Last edited by goaliepride; 2nd March 2011 at 10:46 PM. Reason: fixed

  2. #2
    goaliepride's Avatar
    Join Date
    Feb 2008
    Posts
    47
    Thank Post
    4
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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?

SHARE:
+ Post New Thread

Similar Threads

  1. Route Statement
    By LeonieCol in forum Wireless Networks
    Replies: 4
    Last Post: 20th September 2010, 12:00 PM
  2. Best Mission Statement Words
    By blackcat in forum General Chat
    Replies: 10
    Last Post: 22nd December 2007, 10:30 AM
  3. Vision Statement
    By paulpmp4 in forum Virtual Learning Platforms
    Replies: 5
    Last Post: 29th October 2007, 10:50 AM
  4. the truth is out.....
    By broc in forum General Chat
    Replies: 1
    Last Post: 18th April 2007, 10:30 AM
  5. Excel IF statement maybe VB
    By danIT in forum General Chat
    Replies: 1
    Last Post: 5th January 2007, 12:12 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •