Solved

Create batch file to run a command line script.

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

790 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