怎么用批处理查找文件并修改其中的字符
发布网友
发布时间:2022-04-21 21:18
我来回答
共2个回答
热心网友
时间:2023-07-31 17:21
如果是固定在C盘的,那么就不需要那么多多余的命令
@echo off
cd /d C:\
for /f "delims=" %%i in ('dir /a-d/s/b "ieconfig.ini" 2^>nul') do (
cd /d "%%~dpi"
goto start
)
exit
:start
setlocal enabledelayedexpansion
set file=ieconfig.ini
set replaced=F_Ms
set all=Lei.
for /f "delims=" %%i in ('type "%file%"') do (
set str=%%i
set "str=!str:%replaced%=%all%!"
echo !str!>>"%file%"_tmp.txt
)
move "%file%"_tmp.txt "%file%"
热心网友
时间:2023-07-31 17:21
echo off
setlocal enabledelayedexpansion
set replaced=F_Ms
set all=Lei.
set file=%%i
for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f "delims=*" %%i in ('dir /s/b/a-d "%%a:\ieconfig.ini" 2^>nul') do (
ECHO %%i
for /f "delims=" %%j in ('type "%file%"') do (
echo %%j
set str=%%j
set "num=!str:%replaced%=%all%!"
echo !num!>>"%file%_tmp.txt"
move /y "%file%_tmp.txt" "%file%"
)))
exit