@echo off
%~d0
cd %~dp0

::读取版本配置文件
set configVersion=serviceName.txt
for /f "tokens=1,2 delims=:" %%a IN (%configVersion%)  Do (
     set tag1=%%a
     set tag2=%%b
)
set serviceName=%tag2%
echo %tag1%=%serviceName%

if %serviceName% == "" (
     echo serviceName is error
     pause
     exit
)

set exe=%cd%
echo exe=%exe%
cd ..
set apppath=%cd%\net6.0\Panda.WebUI.IoTCenter.exe
echo appPath=%apppath%

cd %exe%
nssm install %serviceName% %apppath%
nssm set %serviceName% DisplayName "%serviceName%"
nssm set %serviceName% Description "%serviceName%"
nssm start %serviceName%

pause