Solved

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

Posted on 2014-01-12
5
190 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 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now