Link to home
Start Free TrialLog in
Avatar of pphreadr
pphreadrFlag for United States of America

asked on

Why can I not use the colons in this shortcut creation?

Remove the Colons and it works, but I need the colons.
Option Explicit 

'Enumerate all variables
Dim strDesktop, oUrlLink, WshShell, oShellLink

	set WshShell = WScript.CreateObject("WScript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
	oShellLink.TargetPath = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe" & " -cFLShandsUF_MGR:navicare.shands.ufl.edu:7024" & " -uOR" & " -zview"
	oShellLink.WindowStyle = 1
	oShellLink.Hotkey = "CTRL+SHIFT+F"
	oShellLink.Description = "BedBoard"
	oShellLink.WorkingDirectory = strDesktop
	oShellLink.Save

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mankowitz
mankowitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pphreadr

ASKER

Outstanding. Just what I needed. thanks.
any way to make the target and switches variables?
Something like this. I will then read a file to set the variables.
Option Explicit 

'Enumerate all variables
Dim strDesktop, oUrlLink, WshShell, oShellLink, objServer, objUser, objPasswd, objTarget

	set objTarget = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe"
	set objServer = "-cFLShandsUF_MGR:navicare.shands.ufl.edu:7024"
	set objUser = "-uOR"
	set objPasswd = "-zview"
	set WshShell = WScript.CreateObject("WScript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
	oShellLink.TargetPath = objTarget
	oShellLink.Arguments = objServer & " " & objUser & " " & objPasswd
	oShellLink.WindowStyle = 1
	oShellLink.Hotkey = "CTRL+SHIFT+F"
	oShellLink.Description = "BedBoard"
	oShellLink.WorkingDirectory = strDesktop
	oShellLink.Save

Open in new window

OK, I got it.
Option Explicit 

'Enumerate all variables
Dim strDesktop, oUrlLink, WshShell, oShellLink, objServer, objUser, objPasswd, objTarget

	objTarget = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe"
	objServer = "-cFLShandsUF_MGR:navicare.shands.ufl.edu:7024"
	objUser = "-uOR"
	objPasswd = "-zview"
	set WshShell = WScript.CreateObject("WScript.Shell")
	strDesktop = WshShell.SpecialFolders("Desktop")
	set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
	oShellLink.TargetPath = objTarget
	oShellLink.Arguments = objServer & " " & objUser & " " & objPasswd
	oShellLink.WindowStyle = 1
	oShellLink.Hotkey = "CTRL+SHIFT+F"
	oShellLink.Description = "BedBoard"
	oShellLink.WorkingDirectory = strDesktop
	oShellLink.Save

Open in new window