?
Solved

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

Posted on 2014-01-12
5
Medium Priority
?
201 Views
Last Modified: 2014-01-12
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

0
Comment
Question by:pphreadr
  • 4
5 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 400 total points
ID: 39775615
Targetpath can only contain the executable. You have to put arguments into arguments

Try this:

oShellLink.TargetPath = "C:\Program Files (x86)\NaviCare Systems\NaviCare7.1\cpmnav32.exe" 
oShellLink.Arguments = " -cFLShandsUF_MGR:navicare.shands.ufl.edu:7024  -uOR  -zview"

Open in new window

0
 

Author Closing Comment

by:pphreadr
ID: 39775667
Outstanding. Just what I needed. thanks.
0
 

Author Comment

by:pphreadr
ID: 39775680
any way to make the target and switches variables?
0
 

Author Comment

by:pphreadr
ID: 39775686
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

0
 

Author Comment

by:pphreadr
ID: 39775689
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

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question