|
| How to get Errors in an external file |
 |
Wed, 9 Apr 2008 06:02:01 -0700 |
Hi, I am trying to get error messages out of a script into an external file
For example:
New-Item d:\ -Name $Eingabe -type directory | Out-File -FilePath $Logfile
-Append
$? | Out-File -FilePath $Logfile -Append
I am getting the results out of $? (true) in an file, but I want an extra
file for every false message.
Is there something like an error level in PowerShell?
Greetz
--
|
| Post Reply
|
| Re: How to get Errors in an external file |
 |
Wed, 9 Apr 2008 09:44:50 -0600 |
# append error messages to a file
New-Item d:\ -Name $Eingabe -type directory 2>> $errFile
# PowerShell has an automatic variable that contains last
# executed legacy apps' exit code:
cmd /c exit 99
$lastExitCode
# for more on Redirection operators:
help about_operator
# for more on Automatic variables:
help about_Automatic_variables
--
Kiron |
| Post Reply
|
|
|
|
|
|
|
|
|
|