Re: java command line space & escape character parser for Runtime.exec
- From: "Robert Mark Bram" <robertmarkbram@xxxxxxxxx>
- Date: 30 Oct 2006 21:14:34 -0800
Hi Jimmy,
i.e. on the extreme side, here is a possible string (assuming user
always uses double slashes)
"\"C:\\My Test\\my test batch.bat" argA \"arg B\" \"arg\ C\" \"arg\tD\"
\"arg \/E\""
When you call Runtime.exec(), you don't need to have all the arguments
quoted.
Instead, use one of the forms of exec() that accepts a string array -
cmdarray - as the first argument. For example:
exec(String[] cmdarray)
The first string is the command and each string after that is a command
line argument. Of course, this assumes you have control over how the
input to your code gets formatted, so it might not help you...
Rob
:)
.
- References:
- java command line space & escape character parser for Runtime.exec
- From: jimmy_please@xxxxxxxxx
- java command line space & escape character parser for Runtime.exec
- Prev by Date: parse a textfile containing japanese characters
- Next by Date: Re: parse a textfile containing japanese characters
- Previous by thread: java command line space & escape character parser for Runtime.exec
- Next by thread: Re: java command line space & escape character parser for Runtime.exec
- Index(es):
Relevant Pages
|