diff --git a/release.bat b/release.bat index 2fada6c..d9d771c 100644 --- a/release.bat +++ b/release.bat @@ -1,5 +1,5 @@ @echo off -chcp 65001 >nul +chcp 65001 >nul 2>&1 setlocal EnableDelayedExpansion echo ======================================== @@ -7,6 +7,9 @@ echo PackagingMallShipper - Release Tool echo ======================================== echo. +:: 切换到脚本所在目录 +cd /d "%~dp0" + :: 检查 Inno Setup set "ISCC=" if exist "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" ( @@ -27,10 +30,18 @@ if "%ISCC%"=="" ( ) :: 读取当前版本号 -for /f "tokens=2 delims=<>" %%a in ('findstr /C:"" PackagingMallShipper\PackagingMallShipper.csproj') do ( +set "CURRENT_VERSION=" +for /f "tokens=2 delims=<>" %%a in ('type "PackagingMallShipper\PackagingMallShipper.csproj" ^| findstr ""') do ( set "CURRENT_VERSION=%%a" ) +if "%CURRENT_VERSION%"=="" ( + echo [Error] Could not read version from csproj file + echo. + pause + exit /b 1 +) + echo [Info] Current version: %CURRENT_VERSION% echo.