本帖最后由 apang 于 2014-6-11 11:38 编辑
- @set @n=0; /* & echo off
- dir /b *.xls | cscript -nologo -e:jscript "%~0" "%~dp0"
- pause & exit/b & rem */
-
- var oExcel = new ActiveXObject("Excel.Application");
- oExcel.Visible = false
- while (!WScript.StdIn.AtEndOfStream) {
- var f = WScript.StdIn.ReadLine();
- var s = f.substr(0, f.lastIndexOf("."));
- oExcel.WorkBooks.Open(WScript.Arguments(0) + f);
- var count = oExcel.WorkSheets.Count
- for (var i=1; i<=count; i++) {
- var name = s + "_" + oExcel.WorkSheets(i).Name;
- oExcel.WorkSheets(i).Name = name;
- }
- oExcel.ActiveWorkBook.Save();
- oExcel.ActiveWorkBook.Close();
- }
- oExcel.Quit(); oExcel = null
复制代码
|