批处理修改ini配置文件
我有一个配置文件,内容如下:title=2010401启用V6.2userid=99067006U003password=ghtlemen3icservername=19...
我有一个配置文件,内容如下:
title=2010401启用 V6.2
userid = 99067006U003
password = ghtlemen3
icservername =192.123.116.167
icdatabasename =data1
icusername =ten3
icuserpassword =sides
acname =192.123.141.30
acdestpro =ESR3R1
acsendpro =LR3R1L
acsendport =8002
actcpip=0
actp =R0
acinput = 3
waitsecond = 5
[AppUserPref]
toolbartext=FALSE
toolbartips=TRUE
userid=""
我想做一个.bat的批处理文件,运行批处理文件时将该配置文件中的内容:
acdestpro =ESR3R1
acsendpro =LR3R1L
acsendport =8002
改为:
acdestpro =ESR3R0
acsendpro =LR3R0L
acsendport =8001
不知批处理语句怎么写?请各位高手帮忙,不胜感激!!!!!! 展开
title=2010401启用 V6.2
userid = 99067006U003
password = ghtlemen3
icservername =192.123.116.167
icdatabasename =data1
icusername =ten3
icuserpassword =sides
acname =192.123.141.30
acdestpro =ESR3R1
acsendpro =LR3R1L
acsendport =8002
actcpip=0
actp =R0
acinput = 3
waitsecond = 5
[AppUserPref]
toolbartext=FALSE
toolbartips=TRUE
userid=""
我想做一个.bat的批处理文件,运行批处理文件时将该配置文件中的内容:
acdestpro =ESR3R1
acsendpro =LR3R1L
acsendport =8002
改为:
acdestpro =ESR3R0
acsendpro =LR3R0L
acsendport =8001
不知批处理语句怎么写?请各位高手帮忙,不胜感激!!!!!! 展开
展开全部
@echo off
setlocal enabledelayedexpansion
if "%~1"=="" set /p=不要打开本程序,请将要处理的ini文件直接拖到批处理图标上进行处理,<nul&pause&exit
(for /f "delims== tokens=1,2" %%a in ('type %1') do (
set "wkdxz=%%b"
if "%%a"=="acdestpro " set wkdxz=ESR3R0
if "%%a"=="acsendpro " set wkdxz=LR3R0L
if "%%a"=="acsendport " set wkdxz=8001
echo.%%a=!wkdxz!
))>"%~dpn1-wkdxz.ini"
set /p=OK,新文件%~n1-wkdxz.ini已经生成,<nul
pause
保存后,将要处理的ini文件拖到批处理图标上即可处理
=====================================
下面这个不需要拖入,在INI文件夹运行即可,可处理多个ini文件
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /b /a-d *.ini') do (
for /f "delims== tokens=1,2" %%a in ('type %%~si') do (
set "wkdxz=%%b"
if "%%a"=="acdestpro " set wkdxz=ESR3R0
if "%%a"=="acsendpro " set wkdxz=LR3R0L
if "%%a"=="acsendport " set wkdxz=8001
echo.%%a=!wkdxz!>>"%~dp0wkdxz_%%~nxi"
)
echo\OK,新文件 %~dp0wkdxz_%%~nxi 已经生成!
)
pause
多谢yyykkkyyyy老师提醒~
setlocal enabledelayedexpansion
if "%~1"=="" set /p=不要打开本程序,请将要处理的ini文件直接拖到批处理图标上进行处理,<nul&pause&exit
(for /f "delims== tokens=1,2" %%a in ('type %1') do (
set "wkdxz=%%b"
if "%%a"=="acdestpro " set wkdxz=ESR3R0
if "%%a"=="acsendpro " set wkdxz=LR3R0L
if "%%a"=="acsendport " set wkdxz=8001
echo.%%a=!wkdxz!
))>"%~dpn1-wkdxz.ini"
set /p=OK,新文件%~n1-wkdxz.ini已经生成,<nul
pause
保存后,将要处理的ini文件拖到批处理图标上即可处理
=====================================
下面这个不需要拖入,在INI文件夹运行即可,可处理多个ini文件
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /b /a-d *.ini') do (
for /f "delims== tokens=1,2" %%a in ('type %%~si') do (
set "wkdxz=%%b"
if "%%a"=="acdestpro " set wkdxz=ESR3R0
if "%%a"=="acsendpro " set wkdxz=LR3R0L
if "%%a"=="acsendport " set wkdxz=8001
echo.%%a=!wkdxz!>>"%~dp0wkdxz_%%~nxi"
)
echo\OK,新文件 %~dp0wkdxz_%%~nxi 已经生成!
)
pause
多谢yyykkkyyyy老师提醒~
展开全部
@echo off
rem 不要打开本程序,请将要处理的ini文件直接拖到批处理图标上进行处理。
for /f "delims=" %%i in ('type %1^&del %1') do (
set a=%%i
if "%%i" == "acdestpro =ESR3R1" set a=acdestpro =ESR3R0
if "%%i" == "acsendpro =LR3R1L" set a=acsendpro =LR3R0L
if "%%i" == "acsendport =8002" set a=acsendport =8001
call echo %%a%%>>%1
)
echo.
echo 修改已完成,按任意键退出 . . .
pause>nul
rem 不要打开本程序,请将要处理的ini文件直接拖到批处理图标上进行处理。
for /f "delims=" %%i in ('type %1^&del %1') do (
set a=%%i
if "%%i" == "acdestpro =ESR3R1" set a=acdestpro =ESR3R0
if "%%i" == "acsendpro =LR3R1L" set a=acsendpro =LR3R0L
if "%%i" == "acsendport =8002" set a=acsendport =8001
call echo %%a%%>>%1
)
echo.
echo 修改已完成,按任意键退出 . . .
pause>nul
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
借助一个第三方工具wfr,一句命令搞定
wfr
C:\Windows\System32\eadb.ini
-r:"E_Archive01"
-t:"E_Archive02"
wfr
C:\Windows\System32\eadb.ini
-r:"E_Archive01"
-t:"E_Archive02"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询