I am playing around with PowerShell scripts and they're working great. However, I am wondering if there is any way to also show all the commands that were run, just as if you were manually typing them in yourself. This would be similar to "echo on" in batch files. I looked at the PowerShell command-line arguments, the cmdlets, but I didn't find anything obvious. Thanks!
The following command will output each line of script to Write-Debug-
From
man Set-PSDebug
Where I used
echo on
in CMD, I now useWrite-Verbose
andSet-PSDebug -Step
instead. They are not the same, but they are more powerful if wielded skillfully.Will tell you about all the commands and
will return the full list for you to manipulate\display etc.
Ugly:
The problem with the above is that if you have multi-line commands like this:
The above will fail with my example above if that's placed in foo.ps1 with that structure...