@echo off
color 0F
SET PATH=%SystemRoot%\system32\drivers\etc\hosts
SET MIRROR_SERVER_IP_DOMAIN=10.146.217.77 FJS-CTI-DP1
SET MIRROR_SERVER_DOMAIN= "FJS-CTI-DP1"
SET MAIN_SERVER_IP_DOMAIN=10.123.154.251 KNR-CTI-DP2
SET MAIN_SERVER_DOMAIN= "KNR-CTI-DP2"
@echo 初始化終了しました.
copy "\Appupdate.exe" "C:\Program Files\MIT\AppupdateV2\"
cd \
c:
cd %SystemRoot%\system32
findstr %MIRROR_SERVER_DOMAIN% %PATH% && goto addMainServerIPDomain
goto addMirrorServerIPDomain
:addMirrorServerIPDomain
@attrib -r %PATH%
@echo. >> %PATH% & @echo %MIRROR_SERVER_IP_DOMAIN% >>%PATH%
@attrib +r %PATH%
@echo ミラーサーバーの設定するのが追加しました.
goto addMainServerIPDomain
:addMainServerIPDomain
findstr %MAIN_SERVER_DOMAIN% %PATH% && goto exitBlock
@attrib -r %PATH%
@echo. >> %PATH% & @echo %MAIN_SERVER_IP_DOMAIN% >>%PATH%
@attrib +r %PATH%
@echo.
@echo プライマリサーバーの設定するのが追加しました.
goto exitBlock
:exitBlock
pause>nul
exit
字符串替换
@echo off&setlocal
set f="C:\MIT\QuickCRM\login\CTIConfig.cfg"
set src=192.168.1.82
set dst=192.168.0.254
for /f "usebackq delims=" %%a in (%f%) do (
if not defined flag cd.>%f%&set flag=1
set v=%%a
setlocal enabledelayedexpansion
set v=!v:%src%=%dst%!
echo.!v!>>%f%
endlocal
)
goto :eof