Hi there,

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

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

-2
Try this instead
Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" & Chr(34) & " -c " & Chr(34) & "Camellia" & Chr(34)
Answered 01/14/2011 by: AngelD
Red Belt

Please log in to comment
0
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.


ORIGINAL: AngelD

Try this instead
Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" & Chr(34) & " -c " & Chr(34) & "Camellia" & Chr(34)
Answered 01/14/2011 by: dyehardfan
Second Degree Blue Belt

Please log in to comment
0
It's not the end of the world as I can remove the -c "Camellia" and the link works, the user just has to select which VPN profile to connect to at that point. I am just trying to make it seamless.

If anyone else has any insight into this I would love to hear it.
Answered 01/14/2011 by: dyehardfan
Second Degree Blue Belt

Please log in to comment
0
Try this:

Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" & Chr(34) & " -c Camellia"

or

"""C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe""" & " -c Camellia"
Answered 01/14/2011 by: murali.bhat
Purple Belt

Please log in to comment
0
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.
Answered 01/14/2011 by: dyehardfan
Second Degree Blue Belt

Please log in to comment
2
Use the '.Arguments' property for, er, arguments.
Answered 01/17/2011 by: VBScab
Red Belt

Please log in to comment
0
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.

Answered 01/28/2011 by: dyehardfan
Second Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity