PowerTip: Run Part of PowerShell Command

Summary: Learn how to run part of a command in the Windows PowerShell ISE.

Hey, Scripting Guy! Question I am having problems with a small part of a script that I am working on in the Windows PowerShell ISE—
           how can I test only that code?

Hey, Scripting Guy! Answer Highlight only the portion of the script you want to test, and press the F-8 key or the small green triangle on the
           toolbar (or select Run Selection from the File menu). Only the section of code that you highlighted will run.

Comments (2)

  1. tommymaynard says:

    This is an indispensable piece of information. I use it all the time to see the results the commands that would otherwise be assigned to a variable, or even to see what’s currently being stored in an variable: highlight > F8. I don’t ever remember not
    know this, but I would hate to have used the ISE for long without realizing it was an option. Thanks for sharing.

  2. VGSandz says:

    Very useful tip, thanks a lot for sharing!

Skip to main content