473,464 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

trailing space in argument of Runtime.getRuntime().exec(arg[]),

aa
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.
Jul 17 '05 #1
1 9005
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.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Frank Bechmann | last post by:
Eventually most of you will not learn much from this because it's just another event in the 'default argument value gotcha' series, but because it cost me some hours yesterday to spot this 'error'...
8
by: vpadial | last post by:
Hello, I want to build a library to help exporting c++ functions to a scripting languagge. The scripting language provides a function to register functions like: ANY f0() ANY f1(ANY) ANY...
2
by: Marty Meyers | last post by:
I have the following line in a php file: $msg= exec("perl $scriptPath/insert.pl $d $u $t 2>&1", $returnVal); Can someone explain the "2>&1" argument? Second problem, this same line of code...
20
by: Chris | last post by:
I'm not sure if this has been done before, but I couldn't easily find any prior work on Google, so here I present a simple decorator for documenting and verifying the type of function arguments....
7
by: desktop | last post by:
This page: http://www.eptacom.net/pubblicazioni/pub_eng/mdisp.html start with the line: "Virtual functions allow polymorphism on a single argument". What does that exactly mean? I guess it...
6
by: Marshall T. Vandegrift | last post by:
Hi, I'm trying to write a decorator which allows one to produce simple coroutines by just writing a function as a generator expression which re-receives it's arguments as a tuple from each...
2
by: jerry chapman | last post by:
I am trying to send a command to windows from my java program, and I get an error. The pertinent (?) part of my code follows: public boolean action(Event evt, Object arg) { if...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.