Home>

I am trying to create a test tool using set-psbreakpoint.
Is it possible to change the variable of $A to NG after pausing at a breakpoint at the conditional branch of if in test.ps1?
The purpose is to create a tool that covers the conditional branch of if, but I would like to borrow knowledge.

【test.ps1】
$A ="10"
if ($A -eq 10) {
Write-Host"OK"
} else {
Write-Host"NG"
}
Verification tool
Set-PSBreakpoint test.ps1 -Line 3 -Action {$A ="aaa"}

  • Answer # 1

    You just had to change $A to $script: A.
    I apologize to you for a fuss over.

Related articles