Skip to content

Instantly share code, notes, and snippets.

@chen3feng
Created April 24, 2024 08:53
Show Gist options
  • Save chen3feng/8fc7d04d85ab75f9e0ab187cfbc59ce9 to your computer and use it in GitHub Desktop.
Save chen3feng/8fc7d04d85ab75f9e0ab187cfbc59ce9 to your computer and use it in GitHub Desktop.
@echo off
setlocal
rem Check if the script is running with admin privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
echo This script requires administrator privileges. Please run it as an administrator.
goto :END
)
set "CUR_DIR=%~dp0"
set "KEY_NAME=View Dependencies"
set "MENU_TEXT=View Dependencies"
call :AddMenuFor exe
call :AddMenuFor dll
call :AddMenuFor ocx
:END
rem Show pause in double click run mode.
echo %CMDCMDLINE% | findstr /I /c:" /c " >nul && pause
goto :EOF
rem Function AddMenuFor(suffix: string)
rem Add context menu for specified file suffix.
:AddMenuFor
setlocal
set suffix=%1
reg add "HKEY_CLASSES_ROOT\%suffix%file\shell\%KEY_NAME%" /ve /t REG_SZ /d "%MENU_TEXT%" /f >nul
reg add "HKEY_CLASSES_ROOT\%suffix%file\shell\%KEY_NAME%" /v Icon /d "\"%CUR_DIR%DependenciesGui.exe\",0" /f >nul
reg add "HKEY_CLASSES_ROOT\%suffix%file\shell\%KEY_NAME%\command" /ve /t REG_SZ /d "\"%CUR_DIR%DependenciesGui.exe\" \"%%1\"" /f >nul
reg delete "HKEY_CLASSES_ROOT\%suffix%file\shell\%KEY_NAME%\ddeexec" /f >nul 2>&1
endlocal
exit /b
@chen3feng
Copy link
Author

Purpose

Add the context menu for exe and dll files in the file explorer.

Dependencies

Dependencies is a rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.

Usage

  1. Download the release zip package
  2. Extract it
  3. Put this file into it
  4. Run this file as an administrator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment