IT漫步

技术生活札记©Yaohui

Powershell does not support pass Boolean parameter when -File parameter is used

Let’s say there is a Powershell script file named test.ps1 with the following content: param ([Boolean] $FromSchTask) if ($FromSchTask) { echo Yes } else { echo No } When I run this script with -File parameter in command prompt by powershell.exe, for example: C:\>powershell.exe -ExecutionPolicy bypass -File ./test.ps1 -FromSchTask $True It will throw the following …

Proudly powered by WordPress