mardi 4 mai 2021

Power shell condition [closed]

I am trying to do a condition with power shell and some time I get a weird error. Here is my code:

$tmp = 0
$tmp2 = 1
if ($tmp -neq $tmp2) {
    echo +;
}

It gives me an error on -neq saying that it didn't expect -neq after the expression or instruction. The weirdest thing is that some times it work oO. What am I doing wrong?

Thanks in advance

Edit : I found an ungly solution :

$tmp = 0
$tmp2 = 1
if ($tmp -eq $tmp2) {

}
else{
    echo +;
}

But I would like to use -neq any idea ?

Aucun commentaire:

Enregistrer un commentaire