- @set @n=0 /* & @echo off
- set "file=set-client-env.bat"
- echo; 正在搜索...
- (for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist %%a:\nul (
- for /f "tokens=*" %%b in ('dir /b /s /a-d %%a:\set-client-env.bat 2^>nul') do echo;%%b
- )))>tmp.t
- cscript.exe -nologo -e:jscript "%~0" <tmp.t "SET EAS_HOME=" "SET UPDATE_SERVER=" "a.erp.com"
- del tmp.t
- pause & exit /b
- */
- var fso =new ActiveXObject('Scripting.FileSystemObject');
- var re1 = new RegExp("((?:^|\\n)\\s*" + WSH.Arguments(0) + ")(.+)","im");
- var re2 = new RegExp("((?:^|\\n)\\s*" + WSH.Arguments(1) + ")((\\d+\\.){3}\\d+)","im");
- var re3 =/(192\.168\.10\.10|test\.eas\.com)(?=[:\s])/im;
- var r = WSH.Arguments(2);
- while (!WScript.StdIn.AtEndOfStream){
- var f = WScript.StdIn.ReadLine();
- WScript.Echo('\n' + f + '\n');
- var str = fso.OpenTextFile(f, 1).ReadAll();
- var s1 = str.match(re1);
- var s2 = str.match(re2);
- var s3 = str.match(re3);
- if (re3.test(str)) {str = str.replace(re1, "$1" + r)};
- WScript.Echo(str);
- // fso.OpenTextFile(f, 2, true).Write(str);
- }
复制代码
|