复制代码
- WSH.createObject('WScript.shell').run('cmd /c tasklist /fo csv|more +1>0.0', 0, true);
- fso=WSH.createObject('scripting.filesystemobject');
- fr=fso.opentextfile('0.0',1), fw=fso.opentextfile('白名单.txt',2,true);
- while(!fr.AtEndOfStream) fw.writeline(fr.readline().split(',')[0].slice(1,-1));
- fr.close(), fw.close(), fso.deletefile('0.0'), WSH.quit();
按照5楼的新要求订正了4楼代码,可以隐藏运行批处代码的窗口...复制代码
- @(for /f "delims=," %%v in ('tasklist /fo csv^|more +1') do echo,%%~v)>白名单.txt
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |