1

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);

[...]

1 Answer 1

3

I was able to do it like this:

String[] str= { "cmd",  "/c", "start", "powershell.exe", "-NoExit", "-Command", "echo", "hallo" };
Sign up to request clarification or add additional context in comments.

1 Comment

initial cmd /c - is what i've been lacking.. ))

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.