Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to launch shortcut via VBScript?

Status
Not open for further replies.

maysider

Technical User
Apr 5, 2006
15
CZ
How to launch shortcut via VBScript?

"Set WshShell = WScript.CreateObject("WScript.Shell")
girder=WshShell.Run("d:\aDokumenty\Apps\Girder\VBSaJS\BlueAudio.lnk",1,false)"

is not working, but when I click on the shortcut everything is OK

BlueAudio.lnk is a shortcut of bluetooth device, co there is not exact path

thank you
 
You can do it sort of like:

Code:
'Open Sample.lnk in script's folder using the Windows Shell.

Option Explicit

Dim Path, Shell, Folder, FolderItem

Path = WScript.ScriptFullName
Path = Left(Path, InStrRev(Path, "\") - 1)

Set Shell = CreateObject("Shell.Application")
Set Folder = Shell.NameSpace(Path)
Set FolderItem = Folder.Parsename("Sample.lnk")
FolderItem.InvokeVerb "open"

Just put in your LNK file's path and name.
 
>"Set WshShell = WScript.CreateObject("WScript.Shell")
If you put a quote in front, how do you expect it to work? (and then you say it is a typo?! and it still does not work? - I can anticipate all sort of responses.)
[tt]Set WshShell = WScript.CreateObject("WScript.Shell")[/tt]
 
to dilletante: thx but it doesnt help....Ive tried it for other links, it was working, but not for that shortcut :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top