回复 12# sweet惜缘
我的win7上测试OK。
不行换这个试试- @set @n=0//&cscript.exe -e:jscript "%~f0"&pause&exit/b
-
- f1 = "file1.xls";
- f2 = "file2.xls";
-
- fso = new ActiveXObject("Scripting.FileSystemObject");
- csv = fso.GetBaseName(f1) + ".csv";
- fso.MoveFile(f1, csv);
- ts = fso.OpenTextFile("Schema.ini", 2, true);
- ts.WriteLine("["+csv+"]\r\nFormat=TabDelimited\r\n"); ts.Close();
-
- strConnect = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source="' + '.'
- + '";Extended Properties="text;FMT=Delimited;HDR=yes;";';
- strQuery = "SELECT a.* from ["+csv+"] as a "
- + " inner join (select Molecule from [查询1$]"
- + " in '' [Excel 8.0;IMEX=1;HDR=yes;DATABASE="+f2+";]) as b "
- + " ON (a.[ZINC_ID]=b.[Molecule])";
- AdoCnn = new ActiveXObject("ADODB.Connection");
- AdoCnn.Open(strConnect);
- AdoRs = new ActiveXObject("ADODB.Recordset");
- AdoRs.Open(strQuery, AdoCnn, 3);
- s = AdoRs.GetString(2, -1, ",", "\r\n");
- AdoRs.Close();
- AdoCnn.Close();
-
- fso.OpenTextFile('result.csv', 2, true).write(s);
- fso.MoveFile(csv, f1);
- fso.DeleteFile("Schema.ini");
复制代码
|