方式一:

import process.popen;
import console;

var cmd = "netstat -ano";
var p = process.popen.cmd(cmd)
for(all,out,err in p.each(100)){
console.log(out,err);/*读取进程输出直到进程关闭*/
//mainForm.edit.text += out +'\r\n';
}
console.pause();

还有一个方法就是使用process.batch

import process.popen;
import console;

var cmd ='del /f /s /q "%userprofile%\\Local Settings\\Temp\\*.*"';
//var p = process.popen.cmd(cmd)

import process.batch;
var p = process.batch(cmd)

for(all,out,err in p.each(100)){
console.log(out,err);/*读取进程输出直到进程关闭*/
//mainForm.edit.text += out +'\r\n';
}
console.pause();