Page 1 of 1

[SOLVED] Creating a shortcut with an environment variable

Published: August 5, 2024 - 2:07 PM
by ValDo
Hello!
I'm trying to create a slightly unusual shortcut on the desktop and in the Start Menu.
Here's the shortcut's target:
%PRISM_ROOT%\Python311\Prism.exe "%PRISM_ROOT%\Scripts\PrismTray.py" projectBrowser.

I tried using this method:
create_desktop_shortcut(r'Prism Wapt',target=r'%PRISM_ROOT%\Python311\Prism.exe %PRISM_ROOT%\Scripts\PrismTray.py projectBrowser')
but without success.

Another solution would be to copy files to %APPDATA%\Microsoft\Windows\Start Menu\Programs\ and %UserProfile%\Desktop\, but I'd prefer to use the method offered by Wapt!

Thanks in advance for your help!
ValDo

EDIT: I'm on version 2.5.5.15691, package and agent on Windows

Re: Creating a shortcut with an environment variable

Published: August 5, 2024 - 3:47 PM
by t.heroult
Hello, have you tried separating the program and the arguments?

Code: Select all

label = 'Prism Wapt'
target = rf'%PRISM_ROOT%\Python311\Prism.exe'
arguments =  rf'"%PRISM_ROOT%\Scripts\PrismTray.py" projectBrowser'
create_desktop_shortcut(label,target,arguments)

Re: Creating a shortcut with an environment variable

Published: August 6, 2024 - 11:07 AM
by ValDo
Ah, good point, I'll try that, thank you for your reply!