从收盘这么快就停止命令提示符 [英] Stop Command Prompt from closing so quickly

查看:138
本文介绍了从收盘这么快就停止命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图来解决,为什么下面的功能无法正常工作。

I'm trying to troubleshoot why the following function isn't working.

 public void RunCmd()
            {
                string strCmdText;
                strCmdText = "/C [enter command stuff here]";
                System.Diagnostics.Process.Start("CMD.exe", strCmdText);
            }



然而,每当我尝试运行它,或者在一些断点扔,命令打开,显示错误,然后关闭真的很快(这么快,我不能读什么)。

However whenever I try to run it or throw in some breakpoints, command opens, shows an error, and then closes really quickly (so quickly that I can't read anything).

有没有一种方法可以让我停止程序或弄清楚是怎么回事上?断点似乎并不奏效。

Is there a way I can halt the program or figure out what's going on? Breakpoints don't seem to be working.

当我直接在命令键入提示符,而不是通过此C#脚本运行它,它的命令工作正常。

When I directly type it in Command Prompt instead of running it via this c# script, it the command works fine.

推荐答案

试试这个:

 strCmdText = "/K [enter command stuff here]";



/ C执行字符串指定的命令,然后终止

/C Carries out the command specified by string and then terminates

/ K执行字符串,但仍然

/K Carries out the command specified by string but remains

这篇关于从收盘这么快就停止命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆