You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"The third command writes a debug message. It uses the Debug common parameter to override the value of $DebugPreference and to display the debug messages resulting from this command.
As a result, even though the value of $DebugPreference is SilentlyContinue, the debug message appears.".
This is a bit misleading. The debug switch actually changes the $DebugPreference within the context of that command. Also to be seen in the following example:
function testf {
[cmdletbinding()]
param()
Write-Host "DebugPreference is $DebugPreference"
}
PS C:> testf
DebugPreference is SilentlyContinue
PS C:> testf -debug
DebugPreference is Inquire
PS C:>
Moreover, as seen in the above example, the -debug switch doesn't just "display" the message as is stated in the helptext - it sets $DebugPreference to "Inquire" (for some reason totally different from the verbose switch, which would set it to "continue"), and halts execution to inquire if execution should continue - which is very different when used in scripts, for example.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: ef95204d-9964-c3fb-7e51-854736609b04
Version Independent ID: 0604419e-8dc3-2a03-4641-cde87780c864
Activity
Syncing from original (#1)