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?