给你两参考 结果显示符合不 可自己修改下- @if(0)==(0) ECHO OFF
- CScript.exe -NoLogo -E:JScript %0 "%~dp0test.csv" "D37 D38 D39"
- pause&exit
- @end
- var filePath= WSH.Arguments.Item(0)
- var oXL = new ActiveXObject("Excel.application");
- var oWB = oXL.Workbooks.open(filePath);
- oWB.worksheets(1).select();
- var oSheet = oWB.ActiveSheet;
- var ar = WSH.Arguments.Item(1).split(' ');
- var t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- var arr = [],len = ar.length;
- for (var i = 0; i < len; i++) {
- var n = t.indexOf(ar[i].slice(0,1))+1;
- var m = ar[i].slice(1);
- arr.push(oSheet.Cells(m,n));
- }
- WSH.echo(arr);
- oXL.Quit();
复制代码
- @if(0)==(0) ECHO OFF
- CScript.exe -NoLogo -E:JScript %0 <test.csv "D37 D38 D39"
- pause&exit
- @end
- var arr = WSH.StdIn.Readall().split('\r\n');
- var len = arr.length;
- for (var i = 0; i < len; i++) {
- arr[i] = arr[i].replace(/,,/gi,',\s,').split(/\,/);
- }
- var ar = WSH.Arguments.Item(0).split(' ');
- var t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- var tarr = [],len = ar.length;
- for (var i = 0; i < len; i++) {
- var n = t.indexOf(ar[i].slice(0,1));
- var m = ar[i].slice(1)-1;
- tarr.push(arr[m][n]);
- }
- WSH.echo(tarr)
复制代码
|