Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to use the "&" or "-and" commands in PowerShell to perform logical AND operations.

For example, to check if both conditions are true:

if ($a -eq "Yes" -and $b -eq "No") {
  Write-Host "Both conditions are true"
}

Similarly, to run multiple commands in sequence using "&":

& command1
& command2

Or using "-and":

command1 -and command2