- @echo off
- set "old1=#ff0000"
- set "new1=#c10000"
- set "old2=#00ff00"
- set "new2=#009d00"
- for /f "delims=" %%i in ('dir /b /s /a-d *.html') do (
- (for /f "delims=" %%a in ('findstr /n .* "%%i"') do (
- set "str=%%a"
- setlocal enabledelayedexpansion
- set "str=!str:%old1%=%new1%!"
- set "str=!str:%old2%=%new2%!"
- echo=!str:*:=!
- endlocal
- ))>"xxx.html"
- move /y "xxx.html" "%%i"
- )
- pause
复制代码
- @echo off
- for /f "delims=" %%i in ('dir /b /s /a-d *.html') do (
- sed -i "s/#ff0000/#c10000/g;s/#00ff00/#009d00/g" "%%i"
- )
- pause
复制代码
使用前先测试! |