Powershell Cheetsheet

Conditionals

While

IF Conditional

$file = "C:\Users\user\Downloads\.zip"

if(Test-Path $file){
    Write-Host "The file exists!"
}
elseif ($file -eq "C:\Temp\test.txt"){
    Write-Host "The file is a test"
}
else{
   Write-Host "The file does not exists!"
}

For each

Last updated