Q: I have a list of Windows PowerShell commands I need to run as part of a demo--how can I enter these commands during a demo?

A: I do a lot of PowerShell demos, and typically I just type out the commands during the demo. This sometimes leads to some typos. Other times I cut and paste commands from Notepad, which is not very smooth. Several scripts on the Internet help run all the commands in a text file, allowing you to press the return key to display the next line in the file, and then press return to actually run the command.

I found a script at the Microsoft MSDN blog. It creates a Start-Demo function. I also found an enhanced version at PoshCode, which does a great job. Download the Start-Demo.ps1 file from the site, place all your commands in a text file, then pass the text file to the Start-Demo.ps1 script. Here's an example, with output:

.\Start-Demo.ps1 demo.txt
Press ? for help.

[0]≥ get-process skydrive

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
    599      44    16036      16260   160     5.33   5324 SkyDrive


[1]≥ get-service power

Status   Name               DisplayName
------   ----               -----------
Running  Power              power


[2]≥ Write-Host 'The End'
The End

1/27/2013 1:54:18 PM
PS D:\projects\PowerShell>