Solved

running multiple commands from 1 batch file

Posted on 2013-11-30
2
499 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 54

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

756 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