Solved

how to add a command line to my script

Posted on 2011-02-28
4
968 Views
Last Modified: 2012-05-11
i need to enter this command to my logon script.

\\copitrak\copitrakdesktop\CopitrakDesktop10.exe \\copitrak\copitrakdesktop /RELOAD

how do i go about doing this so that all my employees execute this when they log on to their workstations?

thanks

vbs-script.txt
0
Comment
Question by:miamiLAW
  • 2
4 Comments
 
LVL 2

Expert Comment

by:8ubterfug3
ID: 34998317
Does this work?

Run "\\copitrak\copitrakdesktop\CopitrakDesktop10.exe \\copitrak\copitrakdesktop /RELOAD"

Sub Run(ByVal sFile)
Dim shell
    Set shell = CreateObject("WScript.Shell")
    shell.Run Chr(34) & sFile & Chr(34), 1, false
    Set shell = Nothing
End Sub
0
 

Author Comment

by:miamiLAW
ID: 34998348
what do i do, copy and paste this anywhere in my script, quotes and all ?

Run "\\copitrak\copitrakdesktop\CopitrakDesktop10.exe \\copitrak\copitrakdesktop /RELOAD"

Sub Run(ByVal sFile)
Dim shell
    Set shell = CreateObject("WScript.Shell")
    shell.Run Chr(34) & sFile & Chr(34), 1, false
    Set shell = Nothing
End Sub
0
 
LVL 2

Expert Comment

by:8ubterfug3
ID: 34998788
The Sub portion can go at the bottom of your script. That is a sub routine that is called by the Run command. The line that starts with Run would go at the point in your script where you'd like to actually execute the exe file.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 35001234
Hi, I think the extra quotes added by the Sub will cause that to fail.  You should get away with adding this:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "cmd /c \\copitrak\copitrakdesktop\CopitrakDesktop10.exe \\copitrak\copitrakdesktop /RELOAD", 0, True

above this:

'=====================================
'Add On Code goes above this line ----

Regards,

Rob.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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