Skip to content

Instantly share code, notes, and snippets.

@Techlogist
Last active October 3, 2021 12:33
Show Gist options
  • Save Techlogist/6534762841515964024bc8dd9745d2db to your computer and use it in GitHub Desktop.
Save Techlogist/6534762841515964024bc8dd9745d2db to your computer and use it in GitHub Desktop.
Open Command Line in the current directory with a click!
REM License: GNU General Public License v2.0
REM Author: Miguel
REM Website: www.techlogist.net
REM Post: https://techlogist.net/batch/open-command-line-in-the-current-directory-with-a-click/
REM Description: Add entries to the right click context to run CMD
REM OS/Language/Region: Windows/EN-US
REM Start of script
:_start
@echo off
cls
Title Launch CMD as Admin with right click
color f0
mode con:cols=70 lines=15
goto :_start
:_start
REG ADD HKCR\Directory\shell\runas /t REG_SZ /F /d "Run CMD here as Admin"
REG ADD HKCR\Directory\shell\runas\command /t REG_SZ /F /d "cmd.exe /s /k pushd "%V""
REG ADD HKCR\directory\Background\Shell\runas /t REG_SZ /F /d "Run CMD here as Admin"
REG ADD HKCR\directory\Background\Shell\runas\command \"%V\"" /t REG_SZ /F /d "cmd.exe /s /k pushd \"%V\""
REG ADD HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas /t REG_SZ /F /d "Run CMD here as Admin"
REG ADD HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\runas\command /t REG_SZ /F /d "cmd.exe /s /k pushd "%V""
goto _eof
:_eof
cls
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment