@echo off
setlocal

REM === 获取当前目录（程序所在目录） ===
set "APPDIR=%~dp0"
set "TARGET=%APPDIR%Hipos_Lite_POS.exe"

REM === 如果 EXE 不存在，直接退出 ===
if not exist "%TARGET%" exit /b

REM === 获取当前 Windows 用户桌面路径 ===
set "DESKTOP=%USERPROFILE%\Desktop"

REM === 快捷方式文件名 ===
set "SHORTCUT=%DESKTOP%\Hipos_Lite.lnk"

REM === 使用 PowerShell 创建快捷方式（静默，无输出） ===
powershell -NoLogo -NonInteractive -NoProfile ^
 " $WshShell = New-Object -ComObject WScript.Shell; $s = $WshShell.CreateShortcut('%SHORTCUT%'); $s.TargetPath = '%TARGET%'; $s.WorkingDirectory = '%APPDIR%'; $s.IconLocation = '%TARGET%,0'; $s.Save(); " >nul 2>&1

REM === 自动退出，不等待 ===
exit /b
