Solved

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

Posted on 2014-01-12
5
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 100 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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