powershell - -match several $vars in if statement -


I have this, which does not work:

  $ var1 = "6.0 6001 "$ var2 =" 6.1.7001 "$ var3 =" 6.2.8074 "$ var4 =" 6.3.8074 "if ($ var1 -mail" 6.1? "-or" 6.2.? "-or" 6.3. "" } {Write-host "1"} and {write-host "2"}  

No problem, 1 is returned

thanks

Thanks

Run this code:

  "6.2.?" -or "6.3.?") {Write-host "1"} and {write-host "2"}  

this will also return 1 regardless of .

Change your status to:

  if ($ v Ar1-mail "6.1 ??" or $ var1-match "6.2 ??" -or $ var1-match "6.3.?")  

or better than:

  if ($ var1 -match "6. [1-3].?")  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -