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.
This topic is 4 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 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"""
This topic is 4 years and 7 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked