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.getRuntime().exec(arg[]),
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
C:\\Documents and Settings\\XX\\Desktop\\- Copy of TestingFolder -\\jjjj
hihi.doc");
where there is 2 space between dash and "Copy of TestingFolder", but after
going through Runtime.getRuntime().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,FileProtocolHandler
C:\\Documents and Settings\\XX\\Desktop\\-
Copy
of
TestingFolder
-\\jjjjhihi.doc
With quotes it would look like this:
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
\"C:\\Documents and Settings\\XX\\Desktop\\- 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.