process.StartInfo.Arguments不起作用 [英] process.StartInfo.Arguments is not working
本文介绍了process.StartInfo.Arguments不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在这里,我试图通过下面的Vb.Net编码执行命令提示符.
但我不知道为什么这个p.Arguments = com;无法正常工作,但未显示任何错误
预先感谢您的任何解释
问候,
Soumya
Dim com As 字符串 = "
Dim p As 新建 ProcessStartInfo(" )
使用 p
' .FileName = Environment.SystemDirectory& "\ cmd.exe"
p.WorkingDirectory = TextBox1.Text
' 在这里,我尝试使用以下路径"c:\ myown \ course-connect-0.13.3"
p.参数= com
p.WindowStyle = ProcessWindowStyle.Maximized
p.RedirectStandardInput = 真
p.UseShellExecute = 错误
Process.Start(p)
Dim 输出 As String = p.ErrorDialog
解决方案
因为无法识别cmd.exe的参数"md"和"pp"
如果您在此处查看: http://ss64.com/nt/cmd.html [
正如Wes和Sandeep所说:改为使用framework命令: Directory.CreateDirectory [ ^ ]
>
Hi All,
Here I am trying to execute command prompt through below Vb.Net coding.
but I can''t figure out why this p.Arguments = com; is not working.but it''s not showing any error
thanks in advance for any explanation
Regards,
Soumya
Dim com As String = "md pp"
Dim p As New ProcessStartInfo("C:\windows\system32\cmd.exe")
With p
'.FileName = Environment.SystemDirectory & "\cmd.exe"
p.WorkingDirectory = TextBox1.Text
' here i m trying with this path "c:\myown\course-connect-0.13.3"
p.Arguments = com
p.WindowStyle = ProcessWindowStyle.Maximized
p.RedirectStandardInput = True
p.UseShellExecute = False
Process.Start(p)
Dim output As String = p.ErrorDialog
解决方案
Because "md" and "pp" are not recognised parameters to cmd.exe
If you look here: http://ss64.com/nt/cmd.html[^] you will find all the things that the cmd application will know.
And before you ask, I suspect that "md" will not work as a Process either, as it is a built in DOS command.
As Wes and Sandeep have said: use the framework command instead: Directory.CreateDirectory[^]
这篇关于process.StartInfo.Arguments不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文