Created
May 31, 2020 21:14
-
-
Save btipling/567873fd2243307d1995977655cf5de8 to your computer and use it in GitHub Desktop.
A script that prints whether a file exists or not.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ([string] $Path) | |
Get-Item -Path $Path -ErrorAction SilentlyContinue -ErrorVariable test | Out-Null | |
if ($test.Count -eq 0) { | |
Write-Host "The file at $Path exists!" | |
} | |
else { | |
Write-Host "The file at $Path was not found." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment