小编Stu*_*bbs的帖子

调用命令提示符并保持窗口打开

我正在尝试从C#应用程序调用ant脚本.我希望控制台窗口弹出并保持正常(我现在只是调用命令提示符,但我最终想调用一个蚂蚁脚本,这可能需要长达一个小时).这是我正在使用的代码,我从原来改变了:

public void ExecuteCommandSync(object command)
{
    try
    {
        // create the ProcessStartInfo using "cmd" as the program to be run,
        // and "/c " as the parameters.
        // Incidentally, /c tells cmd that we want it to execute the command that follows,
        // and then exit.
        System.Diagnostics.ProcessStartInfo procStartInfo =
        new System.Diagnostics.ProcessStartInfo("cmd", "/k " + command);

        // The following commands are needed to redirect the standard output.
        // This means that it will be redirected to the Process.StandardOutput StreamReader. …
Run Code Online (Sandbox Code Playgroud)

c# ant shell

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

ant ×1

c# ×1

shell ×1