Solved

Create batch file to run a command line script.

Posted on 2004-09-29
4
9,975 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
If you don't know how to downgrade, my instructions below should be helpful.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

11 Experts available now in Live!

Get 1:1 Help Now