Whenever I want to test execution of my script in the PowerShell ISE, the entire script gets echoed to the console before it executes. Then, any actual output from the script gets written starting on a line immediately afterward. This puts a lot of noise in the console, and can make it tricky to find where the script echo ends and the output begins.

Is there a way to disable this echoing of the script into the console?

  • Would Clear-Host be a suitable work-around? – Guy Thomas Jan 8 '14 at 20:33
  • 1
    @GuyThomas I'd rather not. That would make it more difficult to compare output between subsequent runs of the script. – Iszi Jan 8 '14 at 20:35
  • Running PowerShell ISE (x86) was my issue. Running the 64 bit version fix it. – Paul Totzke May 19 '17 at 15:16

Save the script at least once. This will prevent the "script echo" of contents of the script. Instead, it will only echo the path to the saved script when you run the script for testing.

if you have a line, for example

cmd.exe /c "echo foo"

you can path it into null and therefore produce no output

cmd.exe /c "echo foo" > $null

so if you launch your .ps1 from the command line you can do something like this:

PS C:\Users\bodyi> foo.ps1 > $null
  • This doesn't fix the problem. This just removes the script's output, the script itself still gets printed. – 8bittree Aug 2 '17 at 20:04

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.