On Wed, 13 Aug 2003 18:17:23 +0800, "aa" <aa@aa.com> two-finger typed:
Anybody know the solution to trailing space in argument of
Runtime.getRun time().exec(arg[]),
Process p = Runtime.getRunt ime().exec("run dll32 url.dll,FilePro tocolHandler
C:\\Document s and Settings\\XX\\D esktop\\- Copy of TestingFolder -\\jjjj
hihi.doc");
where there is 2 space between dash and "Copy of TestingFolder", but after
going through Runtime.getRunt ime().exec(arg[]), it chopes off one space and
make me can't open the file.
Any help, anyone experienced it before, thank you.
Looks to me like you forgot the extra quotes around the argument starting
with C:
If you do Start -> Run and type the line there, it would look to rundll32
as if you gave five arguments, not the one. The same happens with exec().
Both see a total of 6 parameters:
url.dll,FilePro tocolHandler
C:\\Documents and Settings\\XX\\D esktop\\-
Copy
of
TestingFolder
-\\jjjjhihi.doc
With quotes it would look like this:
Process p = Runtime.getRunt ime().exec("run dll32 url.dll,FilePro tocolHandler
\"C:\\Docume nts and Settings\\XX\\D esktop\\- Copy of TestingFolder -\\jjjj
hihi.doc\"");
And both exec (I hope) as well as rundll32 see the entire file location as
a single parameter.
Cheers.