PowerShell script exchange
Post Reply
Andreas Neufert
VP, Product Management
Posts: 4379
Liked: 821 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany

Andys scripting corner - Exit code to cmd handover

Post by Andreas Neufert »


in addition to my other scripts you can handover the errorresultcounter ore another counter to a cmd that starts the powershell.


Code: Select all

powershell -command "& { C:\exit\exit.ps1; exit $lastexitcode }" 
Echo %Errorlevel%”
You can add "pause" at the end if you want to see what happens.


Code: Select all

$resultcounterend = "999"  # If you want to handover a number
# $Resultcounterend = $Resultcounter + $error.count # If you using my othe scripts
# $resultcounterend = $resultcounter # If you want to handover the nomal poweshell error level

Exit $resultcounterend
CU Andy

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests