krlvm / ContextMenuNormalizer

Normalize context menu highlight color in Windows 10 19H1+
GNU General Public License v3.0
73 stars 4 forks source link

Fix install.cmd #4

Open ItsNifer opened 9 months ago

ItsNifer commented 9 months ago

Hello, I noticed someone posted this about the main project (AccentColorizer) But if the user extracts the .zip into another drive that's not the C drive, it will result in an error. Simply changing cd %~dp0% to cd /d %~dp0 will fix it.

Also I noticed that the install.cmd script requires Administrator privilege's to properly copy .exe You can force Admin with this code:

@echo off
@C:\Windows\System32\chcp 28591 > nul
@C:\Windows\System32\mode con cols=105 lines=35
@Title Start as Admin 
:: Checking for admin rights
::------------------------------------------
REM --> Checking Permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> Error: No admistrative privlages
if '%errorlevel%' NEQ '0' (
REM --> Checking administrative privileges
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
@echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"="
echo UAC.ShellExecute "%~s0", "%params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
@cls
GOTO Main

:Main
(rest of the script)
krlvm commented 9 months ago

Thank you, I'll update it