- @if(0)==(0) echo off
- pushd "%~dp0"
- dir /b *.xls | cscript //nologo //e:jscript "%~f0" "%~dp0"
- pause & exit
- @end
-
- var strPath = WSH.Arguments(0);
- var objExcel = new ActiveXObject('Excel.Application');
- var objNewBook = objExcel.WorkBooks.Add();
- objExcel.Visible = true;
- objExcel.DisplayAlerts = false;
- var n = 1;
-
- while(!WSH.StdIn.AtEndOfStream) {
- var strFile = strPath + WSH.StdIn.ReadLine();
- var objBook = objExcel.WorkBooks.Open(strFile);
- objBook.WorkSheets(1).UsedRange.Copy();
- objNewBook.WorkSheets(1).Range('A' + n).PasteSpecial();
- n += objBook.WorkSheets(1).UsedRange.Rows.Count;
- objBook.Close();
- }
- objNewBook.SaveAs(strPath + 'result.csv', 6);
- objNewBook.Close();
- objExcel.Quit();
复制代码
|