- @if (0)==(0) echo off
- set "替换前=ABC"
- set "替换后=123"
- for /f "tokens=1*delims=/" %%i in ('dir /b /ad /s^|sort /r^|cscript //nologo //e:jscript "%~0" "%替换前%" "%替换后%"')do (
- ren "%%j" "%%i"
- )2>nul
- pause & exit
- @end
-
- var arg = WSH.Arguments;
- var reg = new RegExp(arg(0).replace(/[\^$(){}\[\]+\-.]/g, '\\$&'), 'ig');
- var str = WSH.StdIn.ReadAll().replace(
- /.+\\(.+)\r\n/g,
- function(s0, s1){
- if (reg.test(s1)) return s1.replace(reg, arg(1)) + '/' + s0;
- }
- )
- WSH.Echo(str)
复制代码
|