Q: Passing bool parameter to powershell script shortcut I've written a powershell script that takes a bool parameter
I also have a windows shortcut to this powershell script.
The problem is that whenever I try to run the script from the shortcut, the parameter is interpreted as a string, not a bool, and the script crashes.
This is what I initially placed under the target section of my shortcut:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1" $true

I've searched for solutions online and tried the following options as well:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1" -copyAll:$true

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1" -copyAll:`$$true

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1" "`$$true"

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File "C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1" `$$true

And multiple such variations.
This is my question to you: Is there a way to send the value of a bool parameter to the script when running a from a windows shortcut?

A: try with this:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "& 'C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1'" -copyAll:$true

of with -file parameter to pass bool to a switch parameter of your script try:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file "C:\Program Files\MySoftware\diagnostic\DiagnosticTool.ps1" {-All:$False}

The last one is taked from TechNet but to be honest I'll never be able to work with it.
