Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBoss: How to ignore Press any key to continue, without editing the jboss-cli.bat?

We are trying to read the JBoss status using the jboss-cli.bat command.

jboss-cli.bat -c --command=":read-attribute(name=server-state)" > "$env:JBOSS_HOME\JbossServerStatus.txt"

Storing the status in the TXT file. Since "Press any key to continue" occurs, the controller doesn't return back.

Is there any way to ignore the Press any key to continue without editing the jboss-cli.bat? We know that by adding set NOPAUSE = true, will avoid this problem, but we are looking for solution without editing the file.

like image 250
Chandru M Avatar asked Apr 11 '17 11:04

Chandru M


1 Answers

The jboss-cli.bat includes a line as

 if "x%NOPAUSE%" == "x" pause

so, we only need to declare a environment variable called NOPAUSE and set it to some value before calling the jboss-cli.bat

set "NOPAUSE=true"
jboss-cli.bat .....

If the joss-cli.bat is being called from a powershell script (from comments), then we will need to use something like

$env:NOPAUSE = "true"
.\jboss-cli.bat .....
like image 169
MC ND Avatar answered Oct 07 '22 22:10

MC ND