【问题标题】:Powershell open window (from Java.Runtime.exec)Powershell 打开窗口(来自 Java.Runtime.exec)
【发布时间】:2014-08-27 23:20:00
【问题描述】:

简单的问题:

我想用来自 java 的一些命令调用 powershell。但问题是没有出现窗口。我希望出现带有 Powershell 的窗口。

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

[...]

Runtime.getRuntime().exec(str);

[...]

【问题讨论】:

    标签: java powershell runtime exec


    【解决方案1】:

    我可以这样做:

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

    【讨论】:

    • initial cmd /c - 这是我一直缺乏的..))
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-18
    • 2019-11-21
    • 2017-02-25
    • 2021-12-14
    • 2019-02-25
    • 2017-08-26
    相关资源
    最近更新 更多