C#怎么调用系统命令
发布时间:2017-05-16 11:48
相关话题
在使用C#编辑过程中,通常需要利用外部命令来执行一些操作,从而完成特定的功能。下面就让小编教大家C#如何调用系统命令吧。
C#调用系统命令的方法
打开VS2010,点击”文件“→”“新建”→“项目“, 在打开的”新建项目“窗口中,选择”Windows窗体应用程序“,并将工程命名为“CallDos”,最后点击”确定“创建新工程。


从工具栏将”按钮“控件拖放到编辑窗口中,并将其”Text“命名为”获取系统版本信息“。

接着向编程区域拖放一个文本框,并将其”Name“命令为”SystemInfo“。

双击编程窗口中的按钮,输入如图所示的代码:


右击”CallDos“工程名,从弹出的菜单中选择”生成“。

编译成功后,按键盘快捷键F5进行调试,在打开的窗口中点击”获取系统版本信息“按钮,就可以看到结果信息啦。

C#怎么调用系统命令的评论条评论