我试图将参数从VB传递给CMD但是它不起作用,它只会打开我的CMD窗口。谁能告诉我我做错了什么?
Dim start_info As New ProcessStartInfo()
start_info.FileName = ("cmd.exe")
start_info.UseShellExecute = False
start_info.Arguments = "ipconfig"
Dim proc As New Process
proc.StartInfo = start_info
proc.Start()
答案 0 :(得分:2)
当你运行上面的代码时,它与调用" cmd.exe ipconfig"相同。它只是使用参数ipconfig启动命令行。如果从命令行窗口运行它,您将看不到任何结果。您可以简化上述代码:
start_info.FileName = ("ipconfig")
start_info.UseShellExecute = False