1@echo off 2 3rem 查询 searchd 服务是否存在 4 5sc query |find /i "searchd" >nul 2>nul 6if not errorlevel 1 (goto exist) else goto notexist 7 8rem 存在 searchd 服务 9 10:exist 11@echo. 12pause 13goto :eof 14 15rem 不存在 searchd 服务 16 17:notexist 18 19setlocal enabledelayedexpansion 20set txt=%cd% 21set txt=!txt:\=/! 22 23rem 查找 source.txt 文件中的 @DIR@ 替换成 %cd%(当前路径),并保存到文件 target.txt 24 25call :replace %cd%\source.txt @DIR@ %txt% >%cd%\target.txt 26 27@echo. 28pause 29goto :eof 30 31rem 查找替换代码 32 33:replace 34for /f "tokens=1,2* delims=:" %%i in ('findstr /n ".*" %1') do ( 35 set txt=%%j 36 if "!txt!" == "" ( 37 echo. 38 ) else ( 39 echo !txt:%2=%3! 40 ) 41) 42goto :eof
JavaScript 查找替换
Stella981
2021-10-11
1163 0 0
点赞
收藏
评论区
加载中...