problems with exec("rundll32.exe shell32.dll...")

Ranjit Mathew rmathew@hotmail.com
Tue May 20 13:52:00 GMT 2003


>  thanks but this hasn't worked either - in fact passing any file as the
> arg[0] makes no difference(!), I don't think its even getting that far
> (altered the code to as below)
> 
> I don't understand exactly how this could be going wrong, unless maybe "_"
> is somehow munged by Runtime.exec?

The problem that you are reporting as well as that
reported by Oywind can be traced to the fact that
we put a double quote (") around every argument
on a command line before calling Win32 CreateProcess( )
like so:

     "foo" "bar" "snafu"

Both of you can easily reproduce the behaviour that you
are seeing by trying the following on the command line:

     cmd /c echo Hello!

         v/s

     "cmd" "/c" "echo" "Hello!"

(ditto for Andrew's rundll32 case).

However, we had a good reason for doing this:

http://gcc.gnu.org/ml/java-patches/2003-q1/msg00502.html

(Also see the messages following it).

I do not know why this behaviour changes for these
programs - a simple test program in C that I wrote
that merely prints out argv[] never manages to
see the difference between quoted and unquoted
command lines. :-(

Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/




More information about the Java mailing list