/build/static/layout/Breadcrumb_cap_w.png

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:



' 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)

Posted by: anonymous_9363 13 years ago
Red Belt
2
Use the '.Arguments' property for, er, arguments.
Posted by: dyehardfan 13 years ago
Second Degree Blue Belt
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)
Posted by: dyehardfan 13 years ago
Second Degree Blue Belt
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.
Posted by: murali.bhat 13 years ago
Purple Belt
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"
Posted by: dyehardfan 13 years ago
Second Degree Blue Belt
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.
Posted by: dyehardfan 13 years ago
Second Degree Blue Belt
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.

Posted by: AngelD 13 years ago
Red Belt
-2
Try this instead
Chr(34) & "C:\Program Files\Cisco Systems\VPN Client\ipsecdialer.exe" & Chr(34) & " -c " & Chr(34) & "Camellia" & Chr(34)
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ