Skip to content

Latest commit

 

History

History

Write-Debug

Write-Debug

When Write-Debug is used in a command (function or script) with cmdlet binding and the command is invoked with the switch Debug, Write-Debug writes the debug message and prompts:

DEBUG: ...
Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"):

It turns out Yes To All works like Yes, that is it does not affect other Write-Debug statements or the same statement repeated in a loop or pipeline, they will trigger the prompt again each time.

Unlike Write-Debug, the method $PSCmdlet.WriteDebug() works as expected, Yes To All makes subsequent calls of WriteDebug() to work without prompts.

The scripts are interactive and not covered by automated tests:


  • Microsoft Connect 1441324