Skip to content

Instantly share code, notes, and snippets.

@SatoMew
Created August 21, 2023 17:18
Show Gist options
  • Save SatoMew/4e526157b99ddbf2716d2426bdd75dc9 to your computer and use it in GitHub Desktop.
Save SatoMew/4e526157b99ddbf2716d2426bdd75dc9 to your computer and use it in GitHub Desktop.
@echo off
cd /d %~dp0
set "INSTALLDIR=%LOCALAPPDATA%\Programs\Rangi\Polished Map"
if exist bin\Release\polishedmap.exe (
set "SOURCEFILE=bin\Release\polishedmap.exe"
) else (
set "SOURCEFILE=polishedmap.exe"
)
set "INSTALLPATH=%INSTALLDIR%\polishedmap.exe"
if not exist %SOURCEFILE% (
echo polishedmap.exe does not exist.
echo Download it to the same folder as install.bat and retry.
pause
exit /b
)
mkdir "%INSTALLDIR%" 1>nul
copy /b /y %SOURCEFILE% "%INSTALLPATH%" 1>nul
reg add "HKCU\Software\Classes\.blk" /ve /f /d "Polished Map" 1>nul
reg add "HKCU\Software\Classes\Polished Map" /ve /f /d "BLK Map File" 1>nul
reg add "HKCU\Software\Classes\Polished Map\shell\open\command" /ve /f /d "\"%LOCALAPPDATA%\Programs\Rangi\Polished Map\polishedmap.exe\" \"%%1\"" 1>nul
set LNKSCRIPT="%TEMP%\polishedmap-lnk-%RANDOM%.vbs"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %LNKSCRIPT%
echo sLinkFile = "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Polished Map.lnk" >> %LNKSCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %LNKSCRIPT%
echo oLink.TargetPath = "%INSTALLPATH%" >> %LNKSCRIPT%
echo oLink.Save >> %LNKSCRIPT%
cscript /nologo %LNKSCRIPT%
del /q %LNKSCRIPT% 1>nul
echo Installed Polished Map to:
echo shell:UserProgramFiles\Rangi\Polished Map
echo Shortcut added to Start.
echo You may now delete the downloaded copy of polishedmap.exe.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment