(view source code of dll_menu.bat as plain text)
@ECHO OFF
ECHO.
ECHO DLL_Menu.bat, Version 1.01 for Windows 2000 / XP
ECHO Add "Register" and "Unregister" entries to
ECHO Explorer's context menu for .DLL and .OCX files
ECHO.
ECHO Usage: DLL_MENU
ECHO.
ECHO Warning: This batch file will modify the registry.
ECHO Testen in Windows XP SP2 only.
ECHO Use this batch file at your own risk.
ECHO.
ECHO Note: Before modifying a registry entry, this batch file
ECHO will export the current settings to a set of .REG
ECHO files (*_Restore.reg) in the current directory
IF "%OS%"=="Windows_NT" ECHO ("%CD%").
IF NOT "%OS%"=="Windows_NT" CD
ECHO In case of emergency, doubleclick these .REG
ECHO files to restore the previous configuration.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
:: Check Windows version and command line arguments
IF NOT "%OS%"=="Windows_NT" GOTO End
IF NOT "%~1"=="" GOTO End
VER | FIND " NT" > NUL && GOTO End
:: Use local variables
SETLOCAL
:: Ask for confirmation
ECHO You are about to modify the registry.
SET /P Answer=Are you sure you want to continue? [y/N]
IF /I NOT "%Answer:~0,1%"=="Y" GOTO End
:: Get or set the file type for DLLs - backup existing settings before changing
FOR /F "tokens=1* delims==" %%A IN ('ASSOC .DLL') DO SET DllFile=%%B
IF NOT DEFINED DllFile (
IF NOT EXIST "C:\Dll_Restore.reg" START /WAIT REGEDIT.EXE /E Dll_Restore.reg "HKEY_CLASSES_ROOT\.DLL"
ASSOC .DLL=dllfile
SET DllFile=dllfile
)
:: Get or set the file type for OCXs - backup existing settings before changing
FOR /F "tokens=1* delims==" %%A IN ('ASSOC .OCX') DO SET OcxFile=%%B
IF NOT DEFINED OcxFile (
IF NOT EXIST "C:\Ocx_Restore.reg" START /WAIT REGEDIT.EXE /E Ocx_Restore.reg "HKEY_CLASSES_ROOT\.OCX"
ASSOC .OCX=ocxfile
SET OcxFile=ocxfile
)
:: Backup existing settings before changing
IF NOT EXIST "C:\%DllFile%_Restore.reg" START /WAIT REGEDIT.EXE /E "%DllFile%_Restore.reg" "HKEY_CLASSES_ROOT\%DllFile%\shell"
IF NOT EXIST "C:\%OcxFile%_Restore.reg" START /WAIT REGEDIT.EXE /E "%OcxFile%_Restore.reg" "HKEY_CLASSES_ROOT\%OcxFile%\shell"
:: Create a temporary REG file
(
ECHO Windows Registry Editor Version 5.00
ECHO.
ECHO [HKEY_CLASSES_ROOT\%DllFile%\shell]
ECHO.
ECHO [HKEY_CLASSES_ROOT\%DllFile%\shell\Register]
ECHO.
ECHO [HKEY_CLASSES_ROOT\%DllFile%\shell\Register\command]
ECHO @="%windir:\=\\%\\system32\\regsvr32.exe \"%%1\""
ECHO.
ECHO [HKEY_CLASSES_ROOT\%DllFile%\shell\Unregister]
ECHO.
ECHO [HKEY_CLASSES_ROOT\%DllFile%\shell\Unregister\command]
ECHO @="%windir:\=\\%\\system32\\regsvr32.exe /u \"%%1\""
ECHO.
ECHO [HKEY_CLASSES_ROOT\%OcxFile%\shell]
ECHO.
ECHO [HKEY_CLASSES_ROOT\%OcxFile%\shell\Register]
ECHO.
ECHO [HKEY_CLASSES_ROOT\%OcxFile%\shell\Register\command]
ECHO @="%windir:\=\\%\\system32\\regsvr32.exe \"%%1\""
ECHO.
ECHO [HKEY_CLASSES_ROOT\%OcxFile%\shell\Unregister]
ECHO.
ECHO [HKEY_CLASSES_ROOT\%OcxFile%\shell\Unregister\command]
ECHO @="%windir:\=\\%\\system32\\regsvr32.exe /u \"%%1\""
ECHO.
) > "%Temp%.\~%~n0.reg"
:: Import the new settings in the registry
START /WAIT REGEDIT.EXE /S "%Temp%.\~%~n0.reg"
:: Delete the temporary REG file
DEL "%Temp%.\~%~n0.reg"
ENDLOCAL
:End
page last modified: 2024-04-16; loaded in 0.0051 seconds