Skip to content

Instantly share code, notes, and snippets.

@TearTheSky
Created April 15, 2013 00:38
Show Gist options
  • Save TearTheSky/5384899 to your computer and use it in GitHub Desktop.
Save TearTheSky/5384899 to your computer and use it in GitHub Desktop.
ファイル存在確認関数。ファイルが存在する場合はTrueを返す。ファイルが存在しない場合はメッセージを出力してfalseを返す。
#ファイル存在確認関数
Function CheckFileExist($fileName) {
$resultCheckFileExist = Test-Path $fileName
if($resultCheckFileExist -eq $false) {
#いない場合は怒って終了
Write-Host "ファイル名「$fileName」は存在しません。"
return $false
}
else {
return $true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment