Script Help: Desktop Icon with switches
Hi there,
I am using the following code which I have always used for creating shortcuts in different places:
It does not like my syntax in the strAppPath = "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" -c "Camellia" section, but that is the information I need in the link for the Cisco VPN to open with the right profile. Anyone know how I can get it to populate the shortcuts Target field with this properly?
-Jason
I am using the following code which I have always used for creating shortcuts in different places:
' CreateShortCut.vbs - Create a Shortcut.
' VBScript to create .lnk file
' Author Guy Thomas http://computerperformance.co.uk
' Version 2.4 - July 2006
' ----------------------------------------------------------'
Option Explicit
Dim objShell, objDesktop, objLink
Dim strAppPath, strWorkDir, strIconPath
' --------------------------------------------------
' Here are the variables that to change if you are making a 'real' script
strWorkDir ="C:\Program Files\Cisco Systems\VPN Client"
strAppPath = "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" -c "Camellia"
strIconPath = "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe,0"
Set objShell = CreateObject("WScript.Shell")
objDesktop = objShell.SpecialFolders("AllUsersDesktop") 'this is where you assign where shortcut goes
Set objLink = objShell.CreateShortcut(objDesktop & "\CiscoVPN.lnk") 'this changes per install
' ---------------------------------------------------
' Section which adds the shortcut's key properties
objLink.Description = "Camellia VPN"
'objLink.HotKey = "CTRL+SHIFT+X"
objLink.IconLocation = strIconPath
objLink.TargetPath = strAppPath
objLink.WindowStyle = 3
objLink.WorkingDirectory = strWorkDir
objLink.Save
WScript.Quit
It does not like my syntax in the strAppPath = "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" -c "Camellia" section, but that is the information I need in the link for the Cisco VPN to open with the right profile. Anyone know how I can get it to populate the shortcuts Target field with this properly?
-Jason
0 Comments
[ + ] Show comments
Answers (7)
Please log in to answer
Posted by:
dyehardfan
13 years ago
It's very strange. That actually populated the fields correctly, according to the dialog box of the shortcut, but when you run the shortcut I get the following error:
The item 'ipsecdialer.exe" -c "camellia' that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly.
Notice the single quotes before ipsecdialer and after camellia. However, the properties box for the shortcut shows double quotes. If I remove the double quotes from with the properties box of the shortcut that the .vbs creates and replace them with double quotes then apply it works fine...this is strange.
The item 'ipsecdialer.exe" -c "camellia' that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly.
Notice the single quotes before ipsecdialer and after camellia. However, the properties box for the shortcut shows double quotes. If I remove the double quotes from with the properties box of the shortcut that the .vbs creates and replace them with double quotes then apply it works fine...this is strange.
ORIGINAL: AngelD
Try this instead
Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" & Chr(34) & " -c " & Chr(34) & "Camellia" & Chr(34)
Posted by:
dyehardfan
13 years ago
Posted by:
murali.bhat
13 years ago
Posted by:
dyehardfan
13 years ago
ORIGINAL: murali.bhat
Try this:
Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" & Chr(34) & " -c Camellia"
This returned the same error message I received above.
or
"""C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe""" & " -c Camellia"
Doesn't like this syntax either....
Thanks for giving it a shot for me though.
Posted by:
dyehardfan
13 years ago
Much appreciated. I hate to bother with such newb questions, but I do 1000 things a day and only have so much time for each project. It's the folks like you that I truly appreciate.
ORIGINAL: VBScab
Use the '.Arguments' property for, er, arguments.
Posted by:
AngelD
13 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.