批处理脚本,将允许搜索特定的IP,并更改为新的IP地址在一个.ini文件 [英] Batch script that will allow to search a particular IP and change it to a new IP address in a .ini file
本文介绍了批处理脚本,将允许搜索特定的IP,并更改为新的IP地址在一个.ini文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想编写一个批处理脚本,这将允许搜索一个特定的IP,并更改为新的IP地址在一个.ini文件。
I want to write a batch script, that will allow to search a particular ip and change it to a new ip address in a .ini file.
推荐答案
尝试以下更新code,请让我知道,如果你仍然面临的问题。
Try below updated code, please let me know if you still face issues
cls
@Echo Off
SetLocal EnableDelayedExpansion
if exist new.ini ( del /s /q new.ini )
set "search=1.1.1.1"
set "search2=2.2.2.2"
set "replace=7.7.7.7"
set "replace2=8.8.8.8"
for /F "tokens=*" %%a in (Apservice.ini) Do (
Set "filevalue=%%a"
Set filevalue=!filevalue:%search%=%replace%!
Set filevalue=!filevalue:%search2%=%replace2%!
Echo !filevalue!>>new.ini
)
move /y new.ini Apservice.ini
ause
这篇关于批处理脚本,将允许搜索特定的IP,并更改为新的IP地址在一个.ini文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文