Solved

Create batch file to run a command line script.

Posted on 2004-09-29
4
9,981 Views
Last Modified: 2012-05-05
Currently we have a script that is run from a command prompt.  The script is installed on several independent machines and the user types "cscript filescrc.vbs" from the C:\ prompt.  The problem is that when a user goes to START -- RUN, types cmd and gets a command prompt, the user is usually sitting at "C:\Documents and Settings\<username>\...." or so other various place.  It is almost impossible to explain how to use "cd.." to work their way to a "C:\" prompt and we have files going everywhere.

I would like to write a simple batch file that the user can double click on the desktop.  When they click the batch file it will automatically bring up a command prompt, run the script "C:\cscript filescrc.vbs",  and the command prompt box will stay open so they can see that the .vbs script successfully completes.  I'm not worried about automatically closing the command prompt box. The user can exit the command prompt themselves.

Can this be done?  I'm sure it would only be a few lines.  If anyone knows I would sure appreciate the help.

thanks,
Jeff

0
Comment
Question by:jplagens
[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 Comments
 
LVL 3

Accepted Solution

by:
PodExpert earned 300 total points
ID: 12183362
Save the following commands to the script.bat file:

@start /WAIT cscript c:\filescrc.vbs
@echo Now press any key and close the window.
@pause

It should do what you need when executed from anywhere.
0
 
LVL 5

Assisted Solution

by:kemp_a
kemp_a earned 200 total points
ID: 12186405
That will also put you in the wrong directory, try saving this to a file called script.bat which can be anywhere so try your Desktop to start with:

@ECHO OFF
c:
cd\
start /wait  cscript c:\filescrc.vbs
echo Press any key to  close the window
pause
@ECHO ON

Alternatively, you could recode your vbs script so that it starts what it needs to do from root of the C:\ drive.

Cheers
0
 
LVL 4

Author Comment

by:jplagens
ID: 12186824
That is EXACTLY what I needed.  Thank you for all of your help.  It is greatly appreciated.  I got this new script installed and taught the users to click on the batch file and it is working a lot smoother now.  Thanks!
0
 

Expert Comment

by:londell1
ID: 12316306
Hi, I have exchange 5.5 server running on Windows NT 4.0 server. In setting up server monitor and selecting launch a process, I would like to setup a script that will page me when there is a problem with the exchange server. How do I go about building a script for that purpose? Can any one help me? Many thanks!!

Londell
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
If you don't know how to downgrade, my instructions below should be helpful.

726 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