本帖最后由 pcl_test 于 2016-9-8 01:15 编辑
试了下,ps查询有点慢,改成bat+js方案- /*&cls
- @echo off
- set "xls=%~dp01.xlsx"
- :loop
- echo 直接按回车键将退出程序!
- set name=
- set /p name=输入要查询姓名:
- if "%name%"=="" exit
- if "%name%"=="*" set name=
- echo;%name%|cscript -nologo -e:jscript "%~f0" %xls%
- choice /C YNC /M "Y: 不清屏继续查询(默认) C: 清屏并续查询 N: 退出" /D Y /T 15 /N
- if "%ERRORLEVEL%"=="1" (
- goto loop
- ) else if "%ERRORLEVEL%"=="2" (
- exit
- ) else (
- cls
- goto loop
- )
- */
-
-
- var name = WSH.StdIn.ReadLine().replace(/^\s*|\s*$/g,'').split(/\s+/);
- var map={};
- for(var i=0; i<name.length; i++)if(!map[name[i]])map[name[i]]=1;
- var Excel = new ActiveXObject('Excel.Application');
- Excel.DisplayAlerts = 0;
- var WBook = Excel.Workbooks.Open(WSH.Arguments(0));
- for(var i=2; i<=308; i++){
- var username=WBook.ActiveSheet.Cells.Item(i, 1).Text.replace(/^\s*|\s*$/g,'');
- if(map[username]){
- var account=WBook.ActiveSheet.Cells.Item(i, 2).Text;
- var password=WBook.ActiveSheet.Cells.Item(i, 3).Text;
- WSH.echo('username='+username+' account='+account+' password='+password);
- }
- }
- WBook.Close();
- Excel.quit();
复制代码
|