33 lines
940 B
Batchfile
33 lines
940 B
Batchfile
@echo off
|
|
setlocal
|
|
|
|
REM 获取脚本所在目录
|
|
set "scriptPath=%~dp0"
|
|
|
|
REM 返回到上一级目录
|
|
for %%i in ("%scriptPath:~0,-1%") do set "parentDir=%%~dpi"
|
|
|
|
REM 定义软件路径
|
|
set "softwarePath=%parentDir%"
|
|
|
|
REM 定义注册表项路径
|
|
set "REG_PATH=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\HMEnergy"
|
|
|
|
REM 删除现有的注册表项(如果存在)
|
|
reg query "%REG_PATH%" >nul 2>&1
|
|
if %errorlevel%==0 (
|
|
echo 删除现有的注册表项...
|
|
reg delete "%REG_PATH%" /f
|
|
)
|
|
|
|
REM 添加注册表项和值
|
|
reg add "%REG_PATH%" /v DisplayName /t REG_SZ /d "HMEnergy" /f
|
|
reg add "%REG_PATH%" /v UninstallString /t REG_SZ /d "%softwarePath%\uninst.exe" /f
|
|
reg add "%REG_PATH%" /v DisplayIcon /t REG_SZ /d "%scriptPath%\rqeh6000.ico" /f
|
|
reg add "%REG_PATH%" /v DisplayVersion /t REG_SZ /d "1.0.0" /f
|
|
reg add "%REG_PATH%" /v Publisher /t REG_SZ /d "GZHM" /f
|
|
::reg add "%REG_PATH%" /v InstallLocation /t REG_SZ /d "%softwarePath%" /f
|
|
|
|
echo 注册表项已添加
|
|
endlocal
|