以下脚本用于将agent.properties配置文件中127.0.0.1这个默认IP地址修改为用户输入的IP。使用时可自行修改!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
:: description: windows - Replace string :: author: zcy :: date: 2018-10-08 :: site: https://www.imzcy.cn @echo off setlocal enabledelayedexpansion %~d0 set ROOTPATH=%~dp0 set fn=%ROOTPATH%uav\uavagent\config\agent.properties set /p ip=请输入服务端IP地址: (for /f "tokens=*" %%i in (%fn%) do ( set s=%%i set s=!s:127.0.0.1=%ip%! echo !s!))>tmp.txt move /y tmp.txt "%fn%" 2>nul 1>nul if %errorlevel% == 0 (echo Change OK!) echo= pause |
脚本运行界面如下图所示: