Run Powershell script using java

I want to execute powershell cmdlets using java. Is there a way I can implement this? I tried using the Runtime and exec commands, but the output window hangs between them.

0
source share
1 answer

Easier to use the new ProcessBuilder class. There are several pitfalls in Runtime.exec that you need to remember in order for everything to work correctly. For example, you must ensure that input and output streams are handled correctly.

I suggest you google for an example using ProcessBuilder.

0
source share

All Articles