I need to build the following command using ProcessBuilder:
"C:Program FilesUSBDeviewUSBDeview.exe" /enable "My USB Device"
I tried with the following code:
ArrayList<String> test = new ArrayList<String>();
test.add(""C:\Program Files\USBDeview\USBDeview.exe"");
test.add("/enable "My USB Device"");
ProcessBuilder processBuilder = new ProcessBuilder(test);
processBuilder.start().waitFor();
However, this passes the following to the system (verified using Sysinternals Process Monitor)
"C:Program FilesUSBDeviewUSBDeview.exe" "/enable "My USB Device""
Note the quote before /enable
and the two quotes after Device
. I need to get rid of those extra quotes because they make the invocation fail. Does anyone know how to do this?