public class Command extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getAnswerAt(String cmd2launch,
int answerIdx)
Return response on selected line index (0-based) after running selected
command.
|
static String |
getFirstAnswer(String cmd2launch)
Return first line of response for selected command.
|
static List<String> |
runNative(String cmdToRun)
Executes a command on the native command line and returns the result.
|
static List<String> |
runNative(String[] cmdToRunWithArgs)
Executes a command on the native command line and returns the result line by
line.
|
public static List<String> runNative(String cmdToRun)
Runtime.exec(String) and
capture the resulting output in a list of Strings. On Windows, built-in
commands not associated with an executable program may require
cmd.exe /c to be prepended to the command.cmdToRun - Command to runpublic static List<String> runNative(String[] cmdToRunWithArgs)
Runtime.exec(String[]) and capture the resulting output in
a list of Strings. On Windows, built-in commands not associated with an
executable program may require the strings cmd.exe and /c to
be prepended to the array.cmdToRunWithArgs - Command to run and args, in an arraypublic static String getFirstAnswer(String cmd2launch)
cmd2launch - String command to be launchedpublic static String getAnswerAt(String cmd2launch, int answerIdx)
cmd2launch - String command to be launchedanswerIdx - int index of line in response of the commandCopyright © 2020. All rights reserved.