- @if(0)==(0) echo off
- rem 源目录
- set "srcDir=D:\Test"
- rem 目标目录
- set "dstDir=D:\Found"
- rem 文件列表
- set "list=D:\Test\a.txt"
-
- md "%dstDir%" 2>nul
- dir /b /a-d /s "%srcDir%\*" | cscript //nologo //e:jscript "%~f0" "%dstDir%" "%list%"
- pause & goto :EOF
- @end
-
- var arg = WSH.Arguments;
- var map = {};
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- var objFile = fso.OpenTextFile(arg(1), 1);
- var objShell = new ActiveXObject('Shell.Application');
-
- while(!objFile.AtEndOfStream){
- var str = objFile.ReadLine().toLowerCase();
- str = str.replace(/^\s+|\s+$/g, '');
- if(str != '') map[str] = 1;
- }
-
- while(!WSH.StdIn.AtEndOfStream){
- var file = WSH.StdIn.ReadLine();
- var name = fso.GetFile(file).Name.toLowerCase();
- if(map[name]){
- objShell.NameSpace(arg(0)).CopyHere(file, 8);
- fso.DeleteFile(file, true);
- }
- }
复制代码
|