本帖最后由 apang 于 2014-10-12 22:24 编辑
保存为test.bat- @set @n=0;// & cscript -nologo -e:jscript "%~0" & pause & exit
-
- fso = new ActiveXObject('Scripting.FileSystemObject');
- txt = fso.OpenTextFile('a.txt', 1, false, -1).ReadAll();
- re = /([\s\S]*?)(^".+" *=[\s\S]+?)(?=^")/mg;
- s = '';
- r =/^"(Programs|Start Menu|Desktop|Startup|AppData|Templates|Favorites)"/i;
- while ((ar = re.exec(txt)) !=null) {
- if (r.test(ar[2])) {
- s += ar[1] + ar[2].replace(r, '"Common $1"');
- } else s += ar[1];
- }
-
- s1='25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,00,50,00,52,00,\\';
- s2='4f,00,46,00,49,00,4c,00,45,00,25,00';
- p1='25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,\\\\';
- p2='4c,00,45,00,25,00';
- re=new RegExp('(hex\\(2\\):)' + p1 + '( *\\r?\\n *)' + p2, 'ig');
- s = s.replace(re, '$1' + s1 + '$2' + s2);
-
- fso.OpenTextFile('b.txt', 2, true, -1).Write(s)
复制代码
|