本帖最后由 pcl_test 于 2016-5-26 21:51 编辑
- //&cls&cscript -nologo -e:jscript "%~f0" "new.txt" "old.txt"&pause&exit
-
- var t = {};
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- var newtxt = fso.OpenTextFile(WSH.Arguments(0));
- var n = newtxt.ReadAll().replace(/[\r\n]+$/, '').split(/(\r\n){2,}/);
- var oldtxt = fso.OpenTextFile(WSH.Arguments(1));
- var o = oldtxt.ReadAll().replace(/[\r\n]+$/, '').split(/(\r\n){2,}/);
- for(var i=0; i<o.length; i++){
- if(!t[o[i]])t[o[i]]=1;
- }
- for(var i=0; i<n.length; i++){
- if(!t[n[i]])WSH.echo(n[i]+'\r\n');
- }
复制代码
|