How to pass boolean values to a PowerShell script from a command prompt

前端 未结 10 2834
逝去的感伤
逝去的感伤 2020-12-08 12:46

I have to invoke a PowerShell script from a batch file. One of the arguments to the script is a boolean value:

C:\\Windows\\System32\\WindowsPowerShell\\v1.0         


        
10条回答
  •  时光取名叫无心
    2020-12-08 13:19

    A more clear usage might be to use switch parameters instead. Then, just the existence of the Unify parameter would mean it was set.

    Like so:

    param (
      [int] $Turn,
      [switch] $Unify
    )
    

提交回复
热议问题