'调用外部命令执行脚本
       

Process使用的一点心得Dim Myprocess as New Process
Process使用的一点心得        MyProcess.StartInfo.UseShellExecute 
= False
Process使用的一点心得        MyProcess.StartInfo.RedirectStandardOutput 
= True
Process使用的一点心得        MyProcess.StartInfo.CreateNoWindow 
= True
Process使用的一点心得        MyProcess.StartInfo.FileName 
= ("a.exe")
Process使用的一点心得        MyProcess.StartInfo.Arguments 
= (“-q")
Process使用的一点心得

Process使用的一点心得
        MyProcess.Start()
Process使用的一点心得
Process使用的一点心得        
Dim reader As IO.StreamReader = MyProcess.StandardOutput
Process使用的一点心得        
Dim Result as String
Process使用的一点心得        Result 
= reader.ReadToEnd
Process使用的一点心得
Process使用的一点心得

 

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

相关文章: