---------------------------------------------
PS C:\ps\test> .\fc
パラメータ不足
PS C:\ps\test> .\fc a
パラメータ不足
PS C:\ps\test> .\fc a b
ファイルを開けません
PS C:\ps\test> .\fc test_001.ps1 test_001.ps1
一致
PS C:\ps\test> .\fc test_001.ps1 test_002.ps1
不一致
PS C:\ps\test>
---------------------------------------------
$LastExitCode の説明はタイトルのままでそれ以上の説明は
ありません。以下のテストは、fc.exe を使った簡単なサンプル
で、fc.exe が出力するメッセージは表示されません
fc.exe $args[0] $args[1] 2>&1 | out-null
switch ($LastExitCode){
-1 {
"パラメータ不足"
}
2 {
"ファイルを開けません"
}
1 {
"不一致"
}
0 {
"一致"
}
}
posted by
at 2010-04-07 14:22
|
PowerShell2.0
|

|