DSAPI CMD命令行进程代理
Posted dylike
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DSAPI CMD命令行进程代理相关的知识,希望对你有一定的参考价值。
DSAPI.文件.CMD命令行进程代理,是用来和CMD.exe或指定exe进行输出重定向的简化使用工具,可隐藏或显式地启动一个cmd.exe,并将输出流、输入流和错误流重定向至代理,通过事件触发方式与之交互。
相关代码如下:
Private WithEvents CMD命令行 As New DSAPI.文件.CMD命令行进程代理 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click CMD命令行.启动CMD命令行进程() End Sub Private Sub CMD命令行进程_有输出内容(Sender As CMD命令行进程代理, 输出内容 As String) Handles CMD命令行.有输出内容, CMD命令行.有输出报错内容 Me.BeginInvoke(New SetText(AddressOf SetTextA), 输出内容) End Sub Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing CMD命令行.退出进程() End Sub Private Delegate Sub SetText(S As String) Private Sub SetTextA(S As String) TextBox2.Text &= S TextBox2.SelectionStart = TextBox2.TextLength TextBox2.ScrollToCaret() End Sub Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown Select Case e.KeyValue Case Keys.Enter, Keys.Return CMD命令行.输入(TextBox1.Text) TextBox1.Clear() Exit Sub End Select End Sub
以上是关于DSAPI CMD命令行进程代理的主要内容,如果未能解决你的问题,请参考以下文章