Solved

how to add a command line to my script

Posted on 2011-02-28
4
932 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

19 Experts available now in Live!

Get 1:1 Help Now