Powershell: How do I pass variables to switch parameters when invoking powershell at the command line?

后端 未结 2 1567
暗喜
暗喜 2021-02-02 08:08

Normally, if you want to defer the specification of a switch parameter to some variable, you can pass an expression to the switch parameter, as seen with the WhatIf parameter.

2条回答
  •  渐次进展
    2021-02-02 08:25

    This behaviour has been filed as a bug on connect. This is a workaround:

    powershell ./test.ps1 -source test.ps1 -dest test.copy.ps1 -test:$true
    

提交回复
热议问题