Step-by-step Choose “Execute Windows batch command”. Paste this to print out command-lines itself to the console: @echo off type %0 echo. Surround your PowerShell script like this: powershell -noprofile -command "$ErrorActionPreference = 'Stop'; Set-PsDebug -Strict; .\Do-YourJob.ps1" If your script contains external commands (like .exes or .cmds), test each exit code of them by $LASTEXITCODE: bcp.

