Issue - Creating Desktop Shortcuts to PowerShell Scripts

237 views
Skip to first unread message

Stephen Ireland

unread,
Dec 31, 2020, 5:39:38 AM12/31/20
to innosetup
Hi Folks,

I have a requirement to add Menu Items and desktop shortcuts to PowerShell Scripts. Now please no comments that the OS security settings prevent this as there are ways to overcome this.

Here is an example of a base command:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64-setup.ps1  

Add this in to a desktop shortcut and then move that shortcut to a menu item and all works and behaves as one would expect....

BUT... add similar lines into an Inno Script and you get Desktop Icons that you cannot view properties for ... and Menu items just will not create....

i.e.

[Icons]

Name: "{group}\JTSDK64-Setup"; Filename: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64-setup.ps1"; WorkingDir: "{app}"

Name: "{group}\JTSDK64-Tools"; Filename: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64.ps1"; WorkingDir: "{app}"

Name: "{userdesktop}\JTSDK64-Setup"; Filename: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64-setup.ps1"; WorkingDir: "{app}"

Name: "{userdesktop}\JTSDK64-Tools"; Filename: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64.ps1"; WorkingDir: "{app}"

And I have have tried administrative and non administrative install settings - all to no avail. 

How can I make this facility work as intended? On the surface it appears to be an issue with Inno ...

Thanks and Regards,

Steve I

Stephen Ireland (GMail)

unread,
Dec 31, 2020, 6:18:17 AM12/31/20
to inno...@googlegroups.com

Note: Trying separating the C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe and the  -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64-setup.ps1 with Parameters:

--
You received this message because you are subscribed to a topic in the Google Groups "innosetup" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/innosetup/OF0uaEZNRUo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/f0c2dd88-aec1-43a5-90a8-69f3c9fb45f5n%40googlegroups.com.

Bill Stewart

unread,
Dec 31, 2020, 11:46:13 AM12/31/20
to innosetup
On Thursday, December 31, 2020 at 3:39:38 AM UTC-7 stephen....@gmail.com wrote:

Name: "{group}\JTSDK64-Setup"; Filename: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -ExecutionPolicy Bypass -File C:\JTSDK64-Tools\jtsdk64-setup.ps1"; WorkingDir: "{app}"

This code is not correct. You are that the filename is "C:\Windows\System32\WindowsPowerShell\v.0\powershell.exe ...". You are including the parameters with the filename. The parameters should be separate from the filename.

You should write this instead:

Name: "{group}\JTSDK64-Setup"; Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File {app}\jtsdk64-setup.ps1"; WorkingDir: "{app}"; Check: Is64BitInstallMode

(Note that I fixed your hard-coded paths and added Check parameter that you probably want; adjust as appropriate)

Bill

Stephen Ireland (GMail)

unread,
Dec 31, 2020, 12:59:13 PM12/31/20
to inno...@googlegroups.com

Bill,

 

Thanks for the response. I FINALLY found some documentation before your response came through … and Just as the email come in a test file including such adjustments came became available on SourceForge.

 

Two points here: The documentation perhaps needs improvement for this case. Secondly perhaps future releases needs to “spit” out an error message if its not going to create links for us?

 

I’ll report back results soon as the package that this is used with takes a long time to execute.

 

Regards,

 

Steve I

--

You received this message because you are subscribed to a topic in the Google Groups "innosetup" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/innosetup/OF0uaEZNRUo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to innosetup+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages