执行cmd并输出

admin2021-05-10  129

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();
转载请注明原文地址: http://aardio.net/read-181.html
最新回复(0)