vbscript - How to open .lnk file or better known as a shortcut

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
Ldallial
Posts: 1
Last visit: Mon Oct 05, 2020 1:28 pm

vbscript - How to open .lnk file or better known as a shortcut

Post by Ldallial »

I simply have this

set x=createobject("wscript.shell")
x.run %comspec% /k C:\Program Files (x86)\Keysticks.net\Keysticks\KeySticks.lnk"

but gives me return code... invalid character, code: 800A0480

I copy pasted the path... I must be missing something else
:D

jvierra
Posts: 14787
Last visit: Wed May 12, 2021 7:10 am
Answers: 9
Has voted: 3 times
Been upvoted: 9 times

Re: vbscript - How to open .lnk file or better known as a shortcut

Post by jvierra »

You are missing a quote.

x.run "%comspec% /k ""%ProgramFiles(x86)%\Keysticks.net\Keysticks\KeySticks.lnk"""

Locked