开发者

.Net Process keep command window open

right now I am working on a tool that does a lot of work via the Proce开发者_JS百科ss object through the command line. So there are times when I want the command window to not show up and times when I want it to stay open so that the user can see what happened, possibly respond with the appropriate input.

 Dim pro As New Process
        pro.StartInfo.WorkingDirectory = path
        pro.StartInfo.Arguments = command
        pro.StartInfo.FileName = "hg"

        pro.StartInfo.RedirectStandardOutput = True
        If command.Contains("-q") Then
            pro.StartInfo.UseShellExecute = False
            pro.StartInfo.CreateNoWindow = True
            pro.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
        End If

        pro.Start()

        pro.WaitForExit()

        Return pro.StandardOutput.ReadToEnd

The flag that I am checking in the command is for a -q if it doesn't contain this I would like to show the command prompt to the user and wait for them to close it.

Is this possible and if so what am I missing?


If command.Contains("-q") Then
....
Else
Shell("cmd /k" & Command, 1, True)
End If
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜