在VB.net中操作命令提示符 [英] Operate Command prompt within VB.net

查看:189
本文介绍了在VB.net中操作命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VB 2010.我想从我的VB应用程序发送命令行参数,例如创建文件夹或通过cmd复制文件。应隐藏命令窗口。我还想阅读命令提示符窗口的标题。另外我想知道命令窗口何时完成处理。

I use VB 2010. I would like to send command line arguments from my VB app, eg creating folders or copying files through cmd. The command window should be hidden. I would also like to read the title of the Command Prompt window. Also I would like to know when command window has finished processing.

推荐答案





创建一个 system function:

Hi,

Create a system function:
<System.Runtime.InteropServices.DllImport("msvcrt.dll")> _
Public Shared Function system(command As String) As Integer
End Function



现在,您可以为命令调用此函数:


Now, you can call this function for a command:

system("processToStart.exe"); // for example, start a process



此函数不会创建cmd窗口。



希望这有帮助。


This function will not create a cmd window.

Hope this helps.


这篇关于在VB.net中操作命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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