- @set @n=0//&cscript.exe -e:jscript "%~f0"&exit /b
-
- file = "a.txt";
-
- strConnect = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.;'
- + 'Extended Properties="text;HDR=no;FMT=Delimited;";';
- AdoCnn = new ActiveXObject("ADODB.Connection");
- AdoCnn.Open(strConnect);
- //AdoCnn.Execute("Select * into [result.csv] FROM ["+file+"] where [F1] in (select [F1] from ["+file+"] group by [F1] having count([F1])>1)");
- AdoRs = new ActiveXObject("ADODB.Recordset");
- AdoRs.Open("SELECT * FROM ["+file+"] where [F1] in (select [F1] from ["+file+"] group by [F1] having count([F1]) > 1)", AdoCnn, 3);
- n = AdoRs.RecordCount
- s = AdoRs.GetString(2, n, ",", "\r\n");
- AdoRs.Close();
- AdoCnn.Close();
- fso = new ActiveXObject("Scripting.FileSystemObject");
- fso.OpenTextFile('result.txt', 2, true).write(s);
- WScript.Echo("共有"+n+"条重复数据,结果保存在result.txt");
复制代码
|