本帖最后由 bailong360 于 2016-4-3 22:33 编辑
- 1>1/* :
- @echo off
- setlocal enabledelayedexpansion
- set "xlsFile=C:\test.xls"
- for /f "delims=" %%i in ("%xlsFile%") do set "xlsFile=%%~fi"
- for /f "tokens=1,2 delims=, " %%i in ('cscript -nologo -e:jscript "%~f0" "%xlsFile%"') do (
- set /a #%%j+=1
- set ##%%j=%%i,!##%%j!
- )
- for /f "delims=#=" %%i in ('set ##') do echo %%i年级人数(!#%%i!):!##%%i:~,-1!.
- del "%xlsFile:.xls=.csv%"
- pause
- exit /b
- */
- var xlsFile = WScript.Arguments.Item(0);
- var csvFile = xlsFile.replace('.xls', '.csv');
- var FSO = new ActiveXObject('Scripting.FileSystemObject');
- var Excel = new ActiveXObject('Excel.Application');
- Excel.DisplayAlerts = 0;
- var WBook = Excel.Workbooks.Open(xlsFile);
- WBook.SaveAs(csvFile , 6);
- WBook.Save();
- WBook.Close();
- Excel.Quit();
- WScript.Echo(FSO.OpenTextFile(csvFile , 1).ReadAll().replace(/(\d+),/g, '$1 \r\n').replace(/^,/gm, ''));
复制代码 练手来的
话说怎么才能不弹那个是否保存的对话框... |