So, Brandon owes me for this one … he had a problem with the Start-Demo script posted by the PowerShell team because when you try to assign output to a variable (eg: $fileInfo = ls | gm) it would spew it to the host instead. At any rate, I fixed it up for him (for reasons that escape me now), and since I didn’t bill him for the work,[greedy] I might as well share it with all of you for free too, to spare you the same frustration [pullhair].
If you’re not familiar with Start-Demo, it’s a script which basically takes another script and steps through it with pauses. It lets you step forward and backward through the script and even suspend it so you can execute commands in a nested prompt. Now, it has a few more features, and a few more comments to make it a little easier for others to hack in the future.
I actually changed several of the shortcut keys, but they just made more sense to me this way. I also changed the way the input is handled to ReadKey rather than ReadHost so you don’t have to hit ENTER except to run the command … hopefully you’ll find this makes demo smoother to run. To make it less jarring on my setup with my custom prompt, I made the various colors used in the script settable. I also added a few options so that you can even run it fully automatic with a settable pause between commands.
Anyway, I posted the code to the PowerShell Script Repository (where I’ll post any improvements I make in the future), but I’ll embed the current version here as well.
Hey, good point … I updated to show the (now) current revision from the repository…
Hey, great script – but it had a couple of minor issues :
in the 'v' command there were some _ chars missing between $ and lines (causing it to error when trying to view the file)
also need to change (a) Auto Execute to (x) Auto Execute…
But a great script all the same…
.. Ken