By batch Script execute command to start (IBM liberty web) server and then Launch Default Browser with URL

My own batch script is Myscript.bat which is in folder D:\. There is a batch file named server.bat which is located at D:\wlp\bin for starting (IBM liberty web) server. And I use the command D:\wlp\bin>server start defaultServer. I want to start the server by clicking Myscript.bat and then want to display a message "Loading Completed" and the automatically a default browser with URL http://localhost:8080/Demo. But after starting the server I am not able to display message  or launching browser. Please suggest what needs to change in my code.(I am not allowed to look into code of server.bat, so it should not be touched)

Myscript.bat contains-

@echo Starting script
@echo Loading Liberty Profile. This may take some time ...
@cmd /k "%~dp0\wlp\bin\server.bat" start
echo Loading completed
start http://localhost:%NewPort%/HatsDemo
@pause

Command Prompt Screenshot:

D:\wlp\bin>server start defaultServer
Starting server defaultServer.
Server defaultServer started.

D:\wlp\bin>
Aryabhatta MAsked:
Who is Participating?
 
NVITCommented:
Sorry, should be...
call "%~dp0\wlp\bin\server.bat" start

Open in new window

0
 
NVITCommented:
Try changing...
@cmd /k "%~dp0\wlp\bin\server.bat" start

Open in new window


...to
@cmd /k call "%~dp0\wlp\bin\server.bat" start

Open in new window

0
 
Aryabhatta MAuthor Commented:
@cmd /k call "%~dp0\wlp\bin\server.bat" start is producing same effect as @cmd /k "%~dp0\wlp\bin\server.bat" start. After starting server prompt is returning without showing message or launching browser.
0
 
Bill PrewCommented:
Please try below script.

Where is NewPort variable assigned, does that happen in server.bat?

@echo off
echo Starting script
echo Loading Liberty Profile. This may take some time ...
call "%~dp0\wlp\bin\server.bat" start defaultServer
echo Loading completed
start http://localhost:%NewPort%/HatsDemo
pause

Open in new window


»bp
0
 
Aryabhatta MAuthor Commented:
Yep this works
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.