Solved

running multiple commands from 1 batch file

Posted on 2013-11-30
2
491 Views
Last Modified: 2013-11-30
Folks

I have  a batch command that gets run, inside this file there is the following statement

serverhealtcheck.bat -h0.0.0.0.1:7001 -sSVR01 -uBLOGGSJ -psecret01 -fabc.log

i would like the same batch file to run multiple of these statements for different environments

serverhealtcheck.bat -h0.0.0.0.1:7001 -sSVR01 -uBLOGGSJ -psecret01 -fabc.log
serverhealtcheck.bat -h0.0.0.0.2:7002 -sSVR01 -uSMITHP -psecret02 -fabc.log
serverhealtcheck.bat -h0.0.0.0.1:7003 -sSVR01 -uWOODT -psecret03 -fmy.log


how do i achieve this?
0
Comment
Question by:rutgermons
2 Comments
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 39687485
Just add the lines to the BAT file and they will be executed one after the other.  Since you are running a second BAT file from the first, use the CALL command so that after each called BAT file executes, it will come back to the first and continue.  So your bat file would look like:

@echo off
call serverhealtcheck.bat -h0.0.0.0.1:7001 -sSVR01 -uBLOGGSJ -psecret01 -fabc.log
call serverhealtcheck.bat -h0.0.0.0.2:7002 -sSVR01 -uSMITHP -psecret02 -fabc.log
call serverhealtcheck.bat -h0.0.0.0.1:7003 -sSVR01 -uWOODT -psecret03 -fmy.log

Open in new window

~bp
0
 

Author Closing Comment

by:rutgermons
ID: 39687491
Thanks Bill, simple enough and most importantly working as expected
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 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