Im trying to add fleet IDE to my context menu for opening a folder, Ive tried writing a registry entry with bat and powershell and python and had no luck.
this shows up in Regedit but doesnt run the app
@echo off
setlocal enabledelayedexpansion
:: Function to check if the script is running as administrator
:check_admin
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Running without administrative privileges. Reopening with elevated privileges...
set "script_path=%~0"
set "params=%*"
set "batch_cmd=^
set params=!params:*%~0=!
set params=!params:~1!
call "%~0" !params! %*
exit /b
"
powershell Start-Process -Verb RunAs -FilePath "cmd.exe" -ArgumentList "/c %batch_cmd%"
exit /b
)
exit /b
:: Rest of your script here
:main
:: Your existing script logic goes here
:: Call the check_admin function at the beginning
call :check_admin
:: Continue with the main script logic
echo "This script is running with administrative privileges."
:: Define paths and menu text
set "menu_text=Open with Fleet"
set "app_path=C:\Users\dower\AppData\Local\Programs\Fleet\Fleet.exe"
set "icon_path=C:\Users\dower\AppData\Local\Programs\Fleet\Fleet.ico"
:: Function to add a new context menu entry for folders
:add_context_menu
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\%menu_text%" /ve /d "%menu_text%" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\%menu_text%\command" /ve /d "\"%app_path%\" --dir \"%%1\"" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\%menu_text%\Icon" /ve /d "%app_path%,0" /f
exit /b
:: Function to remove the existing context menu entry
:remove_context_menu
reg delete "HKEY_CLASSES_ROOT\Directory\Background\shell\%menu_text%" /f
exit /b
:: Main script
:: Check if the existing entry needs to be removed
for /f "tokens=* delims=" %%a in ('reg query "HKEY_CLASSES_ROOT\Directory\Background\shell" ^| find /i "%menu_text%"') do (
set "existing_entry=%%a"
)
if defined existing_entry (
call :remove_context_menu
)
:: Add a new context menu entry
call :add_context_menu
echo Successfully added '%menu_text%' context menu entry for folders.
If I could kindly get a pointer for bat or other language for best achieving this
https://github.com/samfisherirl/Fleet-IDE-context-menu-Open-Folder-With