Hack Forums
[Shell] Auto-register .OCX and .DLL libraries/models - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Auto-register .OCX and .DLL libraries/models (/showthread.php?tid=6064213)



Auto-register .OCX and .DLL libraries/models - SIM-4581439 - Apr 6, 2020

This isn't complex by any means, but I had some .ocx models that I needed to register and I didn't want to manually do them through the terminal. So lo and behold...

Note: the UAC invoke is not mine. This script indexes all libraries and models in the current directory was well as the sub-directories too.
Code
@echo off >NUL
REM UAC Elevation script from: shorturl.at/pyV35
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
   echo [REQUESTING ELEVATION]
   goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
   echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
   set params = %*:"=""
   echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
   "%temp%\getadmin.vbs"
   del "%temp%\getadmin.vbs"
   exit /B

:gotAdmin
   pushd "%CD%"
   CD /D "%~dp0"

Set "index=%temp%\lib_list.ini"
dir /b /s *.ocx >"%index%"
dir /b /s *.dll >>"%index%"

Setlocal EnableDelayedExpansion
For /F "delims=" %%A IN (%index%) DO (
set "path=%%A"
regsvr32 "!path!"
)
DEL /F /Q "%index%"

cls
ECHO ALL LIBRARIE(S) / MODEL(S) REGISTERED
Timeout /T 5 >NUL
EXIT



RE: Auto-register .OCX and .DLL libraries/models - Hackoo - Apr 13, 2020

شكرا على المشاركة
Thank you for sharing ✌👍


RE: Auto-register .OCX and .DLL libraries/models - SIM-4581439 - Apr 13, 2020

(Apr 13, 2020 12:27 AM)Hackoo Wrote:  شكرا على المشاركة
Thank you for sharing ✌👍

Anytime 😁 سررت بالمساعدة