如何使用Visual Basic代码运行命令提示符命令? [英] How to run a Command Prompt command with Visual Basic code?

查看:140
本文介绍了如何使用Visual Basic代码运行命令提示符命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Visual Basic,更具体地Visual Studio 2010中编码的东西。我想,通过按钮单击,我的程序执行一个命令。那可能吗?

I'm trying to code something in Visual Basic, more specifically Visual Studio 2010. I want, with a button click, my program to execute a command. Is that possible?

推荐答案

是的。您可以使用 Process.Start 启动可执行文件,包括控制台应用程序。

Yes. You can use Process.Start to launch an executable, including a console application.

如果您需要读取应用程序的输出,从其中读取 StandardOutput 流以获取从您启动的应用程序打印的任何内容。

If you need to read the output from the application, you may need to read from it's StandardOutput stream in order to get anything printed from the application you launch.

这篇关于如何使用Visual Basic代码运行命令提示符命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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