Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Small bat file that will prompt for Cmder's root dir. It will set the CMDER_ROOT env variable and register "Cmder Here" context menu entries in Windows Explorer.
@echo off
net file > NUL 2>&1
if not [%ERRORLEVEL%]==[0] (
echo ERROR - RUN AS ADMIN
echo.
goto :done
)
echo Enter the path to the CMDER folder...
echo.
echo EXAMPLES:
echo C:\TOOLS\CMDER
echo C:\CMDER
echo.
echo Note: don't enter a trailing slash!
echo.
set /p PathToCmder="Cmder folder path: "
setx CMDER_ROOT "%PathToCmder%" /M
set CMDER_ROOT=%PathToCmder%
set EscapedPath=%CMDER_ROOT:\=\\%
echo Windows Registry Editor Version 5.00 > "%TEMP%\regcmder.reg"
echo. >> "%TEMP%\regcmder.reg"
echo [HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder] >> "%TEMP%\regcmder.reg"
echo @="Open Cmder Here" >> "%TEMP%\regcmder.reg"
echo "Icon"="\"%EscapedPath%\\icons\\cmder.ico\",0" >> "%TEMP%\regcmder.reg"
echo. >> "%TEMP%\regcmder.reg"
echo [HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command] >> "%TEMP%\regcmder.reg"
echo @="\"%EscapedPath%\\Cmder.exe\" /START \"%%v\"" >> "%TEMP%\regcmder.reg"
echo. >> "%TEMP%\regcmder.reg"
echo [HKEY_CLASSES_ROOT\Directory\shell\Cmder] >> "%TEMP%\regcmder.reg"
echo @="Open Cmder Here" >> "%TEMP%\regcmder.reg"
echo "Icon"="\"%EscapedPath%\\icons\\cmder.ico\",0" >> "%TEMP%\regcmder.reg"
echo. >> "%TEMP%\regcmder.reg"
echo [HKEY_CLASSES_ROOT\Directory\shell\Cmder\command] >> "%TEMP%\regcmder.reg"
echo @="\"%EscapedPath%\\Cmder.exe\" /START \"%%v\"" >> "%TEMP%\regcmder.reg"
regedit "%TEMP%\regcmder.reg"
echo.
echo SUCCESS
:done
pause
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment