Unable to come out of the start command in a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Ram
Posts: 3
Joined: 28 Aug 2015 11:46

Unable to come out of the start command in a batch file

#1 Post by Ram » 28 Aug 2015 11:55

Hi All,

I am trying to test the service which is running or not, hence wrote the below code. It running fine till starting the webpage, after which its not going to the next command (i.e., line number 4). Can someone pls help me to crack it.

Code: Select all

sc \\server_name query ActiveMQ | find /I "STATE" | find "RUNNING"
if errorlevel 1 goto end
sc \\server_name | start http://localhost:1234/

if errorlevel 1 goto end
echo URL is running
goto success
:success
echo Activmq running fine
:end
echo **Error
echo %date% %time% -- Stopping the services - END


Thanks in advance :) Quick response is appreciable.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Unable to come out of the start command in a batch file

#2 Post by Squashman » 28 Aug 2015 16:00

Why are you trying to pipe the sc command to the start command?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Unable to come out of the start command in a batch file

#3 Post by ShadowThief » 28 Aug 2015 18:29

Does the script continue when you close the web page?

Ram
Posts: 3
Joined: 28 Aug 2015 11:46

Re: Unable to come out of the start command in a batch file

#4 Post by Ram » 28 Aug 2015 21:54

it is not working, if i give like below

Code: Select all

sc \\server_name start http://localhost:1234/

Ram
Posts: 3
Joined: 28 Aug 2015 11:46

Re: Unable to come out of the start command in a batch file

#5 Post by Ram » 28 Aug 2015 21:56

After i closed the webpage, i need to press enter in cmd prompt window to make this script to run further.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Unable to come out of the start command in a batch file

#6 Post by Squashman » 29 Aug 2015 07:29

Ram wrote:it is not working, if i give like below

Code: Select all

sc \\server_name start http://localhost:1234/

Because that is not VALID syntax for the SC command.

Post Reply