![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br>
|
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||
|
Guest
Posts: n/a
|
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 -- MCSE 2003 |
||
|
|
|
|
|
|
#2 | ||
|
Guest
Posts: n/a
|
# 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 |
||
|
|
|
|
|