Skip to content

Commit 76676c2

Browse files
committed
Update install script
1 parent 7cce156 commit 76676c2

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

Shared/install_remove.bat

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
11
@echo off
2+
3+
REM ------------------------------ UAC Boilerplate -----------------------------
4+
5+
:init
6+
setlocal DisableDelayedExpansion
7+
set "batchPath=%~0"
8+
for %%k in (%0) do set batchName=%%~nk
9+
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
10+
setlocal EnableDelayedExpansion
11+
12+
:checkPrivileges
13+
NET FILE 1>NUL 2>NUL
14+
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
15+
16+
:getPrivileges
17+
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
18+
ECHO.
19+
ECHO **************************************
20+
ECHO Requesting privilege escalation
21+
ECHO **************************************
22+
23+
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
24+
ECHO args = "ELEV " >> "%vbsGetPrivileges%"
25+
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
26+
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
27+
ECHO Next >> "%vbsGetPrivileges%"
28+
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
29+
"%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
30+
exit /B
31+
32+
:gotPrivileges
33+
setlocal & pushd .
34+
cd /d %~dp0
35+
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
36+
37+
REM -----------------------------------------------------------
38+
239
reg query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=x86 || set OS=x64
340
reg query "HKCR\CLSID" | find /i "{63424DF1-FAA8-4598-97E5-6E95D4A4ED67}" > NUL && goto REMOVE || goto INSTALL
441

@@ -7,7 +44,7 @@ echo Installing Thumbnail Handler (%OS%)
744
regsvr32 Pso2SarThumbnailHandler.%OS%.dll
845
goto END
946
:REMOVE
10-
echo Installing Thumbnail Handler (%OS%)
47+
echo Removing Thumbnail Handler (%OS%)
1148
regsvr32 /u Pso2SarThumbnailHandler.%OS%.dll
1249
goto END
1350
:END

0 commit comments

Comments
 (0)