Solved

running multiple commands from 1 batch file

Posted on 2013-11-30
2
503 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
[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
2 Comments
 
LVL 55

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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

691 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