cmd/batch file could turn on and turn off "echo". So in PowerShell, I have a bunch of "write-host" output, I want somewhere to turn on / off write-host for debugging convenience.
Does PowerShell has such a function?
PowerShell does not echo commands like Cmd.exe, so there's no need for the @Echo Off command in PowerShell.
The ECHO-ON and ECHO-OFF commands are used to enable and disable the echoing, or displaying on the screen, of characters entered at the keyboard. If echoing is disabled, input will not appear on the terminal screen as it is typed. By default, echoing is enabled.
Press F5 or, on the toolbar, click the Run Script icon, or on the Debug menu, click Run/Continue or, in the Console Pane, type C and then press ENTER . This causes the script to continue running to the next breakpoint or to the end of the script if no further breakpoints are encountered.
The most popular command to pause in PowerShell is the Start-Sleep command or cmdlet. Also, the Start-Sleep command is the official and native command provided by PowerShell.
I recommend you simply put
| Out-Null
at the end of any line where privacy matters... it's more or less the same as putting...
@
... at the beginning of any 'batch' line where you want output hidden from users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With