- Java Execute External Program In Windows 7
- Java Run External Program
- Java Execute External Program In Firefox
Active4 years, 11 months ago
I have read this answer stackoverflow answer and it get's me there half way. Here is what I need to do.
Execute this command:
Execute this command: 'c: myexe.exe execute an external program with parameters in PowerShell. Nov 21, 2013 In this Java tutorial, I show how to open another program or internet browser in one line of code using a Process call. Process p = Runtime.getRuntime.exec(String command); Category. The above Java’s code will try to execute the external program (helloworld.exe) and show output in console as exit code of the external program. The sample external program, Helloworld.exe (Visual Basic) Code Explanation.
If I run that straight from within my powershell script
I get this error:
Now I have tried several variations of this including placing the original command in a variable called $cmd and then passing the
If I append the '<' to the $cmd variable the command fails with a similar error as the first one.
I'm stumped. Any suggestions?
Community♦
NormNorm35933 gold badges77 silver badges1919 bronze badges
2 Answers
If you want to run a program, just type its name and parameters:
If you want to run an exe and redirect stdin to it which your example seems to be an attempt of, use:
If you need to specify the full path to the program then you need to use ampersand and quotes otherwise powershell thinks you are defining a plain string:
Björn LindqvistBjörn Lindqvist11.3k99 gold badges5959 silver badges9090 bronze badges
MUY BelgiumJava Execute External Program In Windows 7
MUY BelgiumJava Run External Program
1,22822 gold badges1919 silver badges3333 bronze badges