0

Without using the ProcessBuilder, I can run this command via the prompt successfully.

winexe --user \administrator --password foo //192.168.1.13 "msiexec /qn /i \setup.msi"

I am creating my ProcessBuilder via this constructor

ProcessBuilder(String[] commands)

The String[] arguments that I pass into the ProcessBuilder are as follow

[0] winexe
[1] --user \administrator
[2] --password foo
[3] //192.168.1.13
[4] "msiexec /qn /i \setup.msi"

The output looks like the below so I knew the ProcessBuilder is executing the command except the parameter that I am passing in doesn't seem to be correct. Can anyone spot what I did wrong?

winexe version 0.90
This program may be freely redistributed under the terms of the GNU GPL
Usage: winexe [-?|--help] [--usage] [-d|--debuglevel DEBUGLEVEL]
        [--debug-stderr] [-s|--configfile CONFIGFILE] [--option=name=value]
        [-l|--log-basename LOGFILEBASE] [--leak-report] [--leak-report-full]
        [-R|--name-resolve NAME-RESOLVE-ORDER]
        ...
1
  • 4
    Put every token in its own String in the array. Commented Oct 14, 2013 at 22:25

1 Answer 1

8

you're confusing the ProcessBuilder command line tokens with the logical groupings of the command you are trying to execute. This command does not accept an argument "--password<space>foo", but the array's 3rd element tries nonetheless to pass such a thing.

Have you tried

[0] winexe
[1] --user
[2] \administrator
[3] --password
[4] foo
[5] //192.168.1.13
[6] msiexec /qn /i \setup.msi

?

Sign up to request clarification or add additional context in comments.

2 Comments

Yup, that does the trick! Thanks Except [6] should be [6] msiexec /qn /i \setup.msi without the quote. Many thanks!
Yep. I realized that about 30 ms after submitting, and edited accordingly. (P.S. please accept if this is indeed the correct answer.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.