user3875103
user3875103

Reputation: 45

Powershell open window (from Java.Runtime.exec)

simple Question:

i want to call the powershell with some commands from java. But the Problem is that no Window appears. i want that the window with the Powershell appears.

String[] str= {
"powershell.exe", "-NoExit", "-Command", "echo", "hallo"
}

[...]

Runtime.getRuntime().exec(str);

[...]

Upvotes: 1

Views: 1759

Answers (1)

Mikkel K.
Mikkel K.

Reputation: 373

I was able to do it like this:

String[] str= { "cmd",  "/c", "start", "powershell.exe", "-NoExit", "-Command", "echo", "hallo" };

Upvotes: 3

Related Questions