@ECHO OFF&chcp 65001&mode con cols=35 lines=10
set vcpkgRoot=E:\vcpkg\scripts\buildsystems\msbuild\
setlocal Enabledelayedexpansion
call :G_getrowstr 92 %vcpkgRoot%applocal.ps1 var
if "%var%"=="#resolve($targetBinary) " (
echo disabled
color 4F)
if "%var%"=="resolve($targetBinary) " (
echo enabled
color 2F)
@ECHO.
@ECHO Vcpkg 脚本
@ECHO ========================
@ECHO 1: Enalbe Auto Copy DLL Files
@ECHO 2: Disalbe Auto Copy DLL Files
@ECHO.
@ECHO.
set /p xj= 请输入:
if /i "%xj%" == "1" goto install
if /i "%xj%" == "2" goto remove
@ echo.
:install
ren %vcpkgRoot%applocal.ps1 a.txt
setlocal enabledelayedexpansion
for /f "delims=" %%a in (%vcpkgRoot%a.txt) do (
if /i "%%a"=="#resolve($targetBinary)" (echo resolve^($targetBinary^)>>%vcpkgRoot%b.txt) else echo.%%a >>%vcpkgRoot%b.txt
)
endlocal
ren %vcpkgRoot%b.txt applocal.ps1
del %vcpkgRoot%a.txt
goto end
:remove
ren %vcpkgRoot%applocal.ps1 a.txt
setlocal enabledelayedexpansion
for /f "delims=" %%a in (%vcpkgRoot%a.txt) do (
if /i "%%a"=="resolve($targetBinary)" (echo #resolve^($targetBinary^)>>%vcpkgRoot%b.txt) else echo.%%a >>%vcpkgRoot%b.txt
)
endlocal
ren %vcpkgRoot%b.txt applocal.ps1
del %vcpkgRoot%a.txt
goto end
:G_getrowstr
set %3=
set /A G_skiprows=%1-1
if "%G_skiprows%"=="0" goto :G_getrowstrz
for /f "skip=%G_skiprows% delims=" %%i in ('findstr /n .* %2') do (
for /f "tokens=2* delims=:" %%j in ("%%i") do set %3=%%j
goto :end
)
:G_getrowstrz
for /f "delims=" %%i in ('findstr /n .* %2') do (
for /f "tokens=2* delims=:" %%j in ("%%i") do set %3=%%j
goto :end
)
:end