
CODE: [Copy to clipboard]@echo off
for /f "delims=" %%a in ('dir /s /b /a-d *.html') do (
for /f "tokens=*" %%i in ('type "%%a"') do call :slz "%%a" "%%i"
)
pause
:slz
set xxx=%~1
if not defined xxx goto:eof
set var=%~2
set "var=%var:ABCD=DCBA%"
>>"%~dpn1.tmp" echo %var%
move /y "%~dpn1.tmp" "%~1"
goto:eof
| Quote: | |
|
| Quote: | |
|
CODE: [Copy to clipboard][ Last edited by zh159 on 2007-11-18 at 01:33 AM ]Set WshShell = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
abcd = "Table"
dcba = "DCBA"
WshShell.Run "cmd /c cd.>list.txt",vbhid,True
WshShell.Run "cmd /c dir /b /s /on /a-d *.htm>>list.txt",,True
Set fl = fso.OpenTextFile("list.txt",1)
While not fl.AtEndOfStream
htmlfile = fl.ReadLine
Set fn = fso.GetFile(htmlfile)
Newname = Replace(htmlfile,fn.name,"str-" & fn.name)
Set fr = fso.OpenTextFile(htmlfile,1)
str = Replace(fr.ReadAll,abcd,dcba,1,-1,1)
Set fw = fso.CreateTextFile(Newname,2,Turn)
fw.WriteLine str
fw.Close
fr.Close
Wend
fl.Close
msgbox "OK!"
| Quote: | |
|
CODE: [Copy to clipboard][ Last edited by terse on 2007-11-18 at 01:48 PM ]@echo off
for /r %%i in (*.htm) do (
for /f "delims=" %%a in ('findstr /n .* "%%i"') do (
set list=%%a
setlocal enabledelayedexpansion
set list=!list:*:=!
set list=!list:ABCD=DCBA!
echo/!list! >>"%%i.tmp"
endlocal
)
move /y "%%i.tmp" "%%i" 2>NUL
)
pause
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |