Jump to content

How to add an argument to a shortcut in a VBS script?


Recommended Posts

Posted

Hi, I am wondering if anyone could kindly help me out here.

 

I am having problems to find a way to add an argument to a shortcut in a vbs script I am creating for my Windows 7 start menu pins.

 

As you can see below all my shortcuts are fine and work, except the one which requires the argument. This application is called PARs, see below.

 

Anyone know the answer?

 

Many thanks

 

Dim ObjFolder, ObjFolderItem, colVerbs, objverb, objshell


Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace("C:\Program Files\Internet Explorer")
Set objFolderItem = objFolder.ParseName("iexplore.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\Microsoft Office\Office14")
Set objFolderItem = objFolder.ParseName("MSACCESS.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\Microsoft Office\Office14")
Set objFolderItem = objFolder.ParseName("EXCEL.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\Microsoft Office\Office14")
Set objFolderItem = objFolder.ParseName("POWERPNT.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\Microsoft Office\Office14")
Set objFolderItem = objFolder.ParseName("MSPUB.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\Microsoft Office\Office14")
Set objFolderItem = objFolder.ParseName("WINWORD.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\Microsoft Office\Office14")
Set objFolderItem = objFolder.ParseName("msaccess.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files (x86)\SIMS\PARS .net\")
[b]Set objFolderItem = objFolder.ParseName("Bootstrap.exe" PARS)[/b] [b][i]<----- Doesn't work and displays error message (hope someone can help) [/i][/b]
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

Set objFolder = objShell.Namespace("C:\Program Files\SIMS\SIMS .net")
Set objFolderItem = objFolder.ParseName("Pulsar.exe")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt
Next

WScript.Quit 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...