Powershell打开窗口(来自Java.Runtime.exec)
简单问题: 我想用java中的一些命令调用powershell。但问题是没有窗口出现。我希望显示带有Powershell的窗口Powershell打开窗口(来自Java.Runtime.exec),java,powershell,runtime,exec,Java,Powershell,Runtime,Exec,简单问题: 我想用java中的一些命令调用powershell。但问题是没有窗口出现。我希望显示带有Powershell的窗口 String[] str= { "powershell.exe", "-NoExit", "-Command", "echo", "hallo" } [...] Runtime.getRuntime().exec(str); [...] 我可以这样做: String[] str= { "cmd", "/c", "start", "powershell.exe"
String[] str= {
"powershell.exe", "-NoExit", "-Command", "echo", "hallo"
}
[...]
Runtime.getRuntime().exec(str);
[...]
我可以这样做:
String[] str= { "cmd", "/c", "start", "powershell.exe", "-NoExit", "-Command", "echo", "hallo" };
首字母
cmd/c
-是我一直缺少的东西