Reputation: 115
I'm trying to pass an argument through a shortcut on the script I need. So I've done my shortcut and in the "Target" field I've written my parameter "Test" (C:\Users\MBGR\Desktop\test2.ps1 Test).
In my script I have the "$args[0]" to recieve my parameter. When I'm sending a parameter through Execute from Win7 (powershell.exe -noexit C:\users\MBGR\Desktop\test2.ps1 TEST) it's working great. And also via CMD.
So my question is why is that not working with a shortcut? It's something that work well with VBS, is there a little something I'm missing to make it work?
Upvotes: 3
Views: 8751
Reputation: 58431
You have to add the Powershell executable in front of the script in the Target editbox.
Example
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\users\MBGR\Desktop\test2.ps1 Test
Upvotes: 8