'调用外部命令执行脚本
Dim Myprocess as New Process
MyProcess.StartInfo.UseShellExecute = False
MyProcess.StartInfo.RedirectStandardOutput = True
MyProcess.StartInfo.CreateNoWindow = True
MyProcess.StartInfo.FileName = ("a.exe")
MyProcess.StartInfo.Arguments = (“-q")
MyProcess.Start()
Dim reader As IO.StreamReader = MyProcess.StandardOutput
Dim Result as String
Result = reader.ReadToEnd

学习到了在VB.net中如何调用外部的命令,本来打算是用shell()接调用一下的,但是试了试不行。然后用了相对比较麻烦的Process(个人感觉)。
Process也只能带有一个Arguement,但是可以将输出的结果用流的方式被原进程读取!这个相当不错,一下子就得到了执行的结果了,中间不用再写文件,读文件了(虽然.net中读写文件有时还是挺方便的。)
浙公网安备 33010602011771号