请教怎么将文本文件中字符批量修改为对应需要的字符
1个回答
展开全部
没有按行查找,对所有的指定字符串例如(a="12345"),按要求替换。@echo offsetlocal enabledelayedexpansionfor /f "tokens=*" %%i in ('dir /ad/b /s "e:\test\"') do (set n=%%~niif exist "%%~i\label.xml" (call set /a a=!n!*10call set /a b=!n!*10+9call set /a c=!n!*10+11call set /a d=!n!*10+19REP.vbs "%%~i\label.xml" !a! !b! !c! !d! ))del REP.vbsecho 完成 任意键 退出pause>nulexit:sub1>REP.vbs echo file=wscript.arguments(0)>>REP.vbs echo a1="a="^&chr(34)^&"12345"^&chr(34)>>REP.vbs echo b1="b="^&chr(34)^&"12350"^&chr(34)>>REP.vbs echo c1="c="^&chr(34)^&"12365"^&chr(34)>>REP.vbs echo d1="d="^&chr(34)^&"12370"^&chr(34)>>REP.vbs echo a2="a="^&chr(34)^&wscript.arguments(1)^&chr(34)>>REP.vbs echo b2="a="^&chr(34)^&wscript.arguments(2)^&chr(34)>>REP.vbs echo c2="a="^&chr(34)^&wscript.arguments(3)^&chr(34)>>REP.vbs echo e2="a="^&chr(34)^&wscript.arguments(4)^&chr(34)>>REP.vbs echo set fso=createobject("scripting.filesystemobject")>>REP.vbs echo set fil=fso.opentextfile(file)>>REP.vbs echo S=fil.readall>>REP.vbs echo fil.close>>REP.vbs echo set fi=fso.opentextfile(file,2)>>REP.vbs echo s=Replace(s,a1,a2)>>REP.vbs echo s=Replace(s,b1,b2)>>REP.vbs echo s=Replace(s,c1,c2)>>REP.vbs echo s=Replace(s,d1,d2)>>REP.vbs echo fi.write s>>REP.vbs echo fi.closegoto :eof
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询