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

前端 未结 10 2910
逝去的感伤
逝去的感伤 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:10

    You can also use 0 for False or 1 for True. It actually suggests that in the error message:

    Cannot process argument transformation on parameter 'Unify'. Cannot convert value "System.String" to type "System.Boolean", parameters of this type only accept booleans or numbers, use $true, $false, 1 or 0 instead.

    For more info, check out this MSDN article on Boolean Values and Operators.

提交回复
热议问题