[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

running multiple commands from 1 batch file

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
rutgermons
Asked:
rutgermons
1 Solution
 
Bill PrewCommented:
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
 
rutgermonsAuthor Commented:
Thanks Bill, simple enough and most importantly working as expected
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now