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

1

13

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.

Claudell answered 11/4, 2017 at 11:41 Comment(3)
You don't need to change the batch file, just define the variable before calling the batch file. set "NOPAUSE=true" & jsboss-cli.bat .... Knisley
@MCND It is not working. Here's my code set NOPAUSE="true" jboss-cli.bat -c --command=":read-attribute(name=server-state)" Am running this as .PS1 fileClaudell
Try: < nul jboss-cli.bat ....Sollie
K
21

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 .....
Knisley answered 11/4, 2017 at 15:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.