This commit is contained in:
ZtRXR 2024-05-19 23:58:23 +08:00
parent 58f9360ec0
commit 669c2b6c96

27
install.bat Normal file
View File

@ -0,0 +1,27 @@
@echo off
setlocal
:: 设置几个环境变量以便于后续使用
set SCRIPT_DIR=%~dp0
set SHORTCUT_NAME=webp_to_png.lnk
set ICON_PATH=%SCRIPT_DIR%webp_to_png\program_data\favicon.ico
set TARGET_PATH=%SCRIPT_DIR%webp_to_png.exe
set WORKING_DIR=%SCRIPT_DIR%
set SHORTCUT_PATH=%USERPROFILE%\Desktop\%SHORTCUT_NAME%
:: 创建一个 VBS 脚本来生成快捷方式
echo Set oWS = WScript.CreateObject("WScript.Shell") > "%TEMP%\CreateShortcut.vbs"
echo sLinkFile = "%SHORTCUT_PATH%" >> "%TEMP%\CreateShortcut.vbs"
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> "%TEMP%\CreateShortcut.vbs"
echo oLink.TargetPath = "%TARGET_PATH%" >> "%TEMP%\CreateShortcut.vbs"
echo oLink.IconLocation = "%ICON_PATH%" >> "%TEMP%\CreateShortcut.vbs"
echo oLink.WorkingDirectory = "%WORKING_DIR%" >> "%TEMP%\CreateShortcut.vbs"
echo oLink.Save >> "%TEMP%\CreateShortcut.vbs"
:: 运行生成的 VBS 脚本
cscript /nologo "%TEMP%\CreateShortcut.vbs"
:: 清理临时生成的 VBS 脚本
del "%TEMP%\CreateShortcut.vbs"
endlocal