Hi I'm a newbie in Powershell scripting.. I just wrote a simple function to detect if a file existed called isMarked() which takes the argument of file path string and return true/false.
function isMarked{
param($mark_name)
return Test-Path "$mark_name"
}
I tried and this function works correctly. However, a weird result occurred when I tried to use the logical operator to combine the results.
if(isMarked(".test") -and !(isMarked(".another_test")))
where when I tried individually,
isMarked(".test") returns True
isMarked(".another_test") returns True
But when I combined the logical expression
(isMarked(".test") -and !(isMarked(".another_test"))
which should be False, it gives me a "True".....
I'm not sure what goes wrong. Any suggestions?
Thanks