Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: Add "Open command window here as administrator" context menu in Windows 10 and Windows 11
- @Echo Off & Cls
- (Net session >nul 2>&1)||(PowerShell start """%~0""" -verb RunAs & Exit /B)
- :choice
- Cls & Mode CON LINES=11 COLS=95 & Color 0E & Title Created By FreeBooter
- Echo.
- Echo.
- Echo.
- Echo Add "Open command window here as administrator" to Context Menu (A)
- Echo.
- Echo Remove "Open command window here as administrator" from Context Menu (R)
- Echo.
- Set /p input=^>
- If /i Not %input%==A (Goto :_Ex) Else (Goto :_Add)
- :_Ex
- If /i Not %input%==R (Goto :choice) Else (Goto :_Remove)
- :_Add
- Reg.exe add "HKCR\Directory\shell\OpenCmdHereAsAdmin" /ve /t REG_SZ /d "Open command window here as administrator" /f
- Reg.exe delete "HKCR\Directory\shell\OpenCmdHereAsAdmin" /v "Extended" /f
- Reg.exe add "HKCR\Directory\shell\OpenCmdHereAsAdmin" /v "Icon" /t REG_SZ /d "imageres.dll,-5324" /f
- Reg.exe add "HKCR\Directory\shell\OpenCmdHereAsAdmin\command" /ve /t REG_SZ /d "cmd /c echo|set/p=\"%%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\"" /f
- Reg.exe add "HKCR\Directory\Background\shell\OpenCmdHereAsAdmin" /ve /t REG_SZ /d "Open command window here as administrator" /f
- Reg.exe delete "HKCR\Directory\Background\shell\OpenCmdHereAsAdmin" /v "Extended" /f
- Reg.exe add "HKCR\Directory\Background\shell\OpenCmdHereAsAdmin" /v "Icon" /t REG_SZ /d "imageres.dll,-5324" /f
- Reg.exe add "HKCR\Directory\Background\shell\OpenCmdHereAsAdmin\command" /ve /t REG_SZ /d "cmd /c echo|set/p=\"%%V\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\"" /f
- Reg.exe add "HKCR\Drive\shell\OpenCmdHereAsAdmin" /ve /t REG_SZ /d "Open command window here as administrator" /f
- Reg.exe delete "HKCR\Drive\shell\OpenCmdHereAsAdmin" /v "Extended" /f
- Reg.exe add "HKCR\Drive\shell\OpenCmdHereAsAdmin" /v "Icon" /t REG_SZ /d "imageres.dll,-5324" /f
- Reg.exe add "HKCR\Drive\shell\OpenCmdHereAsAdmin\command" /ve /t REG_SZ /d "cmd /c echo|set/p=\"%%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\"" /f
- Reg.exe delete "HKCR\LibraryFolder\background\shell\OpenCmdHereAsAdmin" /f
- REM ; To allow mapped drives to be available in command prompt
- Reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLinkedConnections" /t REG_DWORD /d "1" /f
- Goto :RestartEx
- :_Remove
- Reg.exe delete "HKCR\Directory\shell\OpenCmdHereAsAdmin" /f
- Reg.exe delete "HKCR\Directory\Background\shell\OpenCmdHereAsAdmin" /f
- Reg.exe delete "HKCR\Drive\shell\OpenCmdHereAsAdmin" /f
- Reg.exe delete "HKCR\LibraryFolder\background\shell\OpenCmdHereAsAdmin" /f
- Reg.exe delete "HKCR\LibraryFolder\background\shell\OpenCmdHereAsAdmin\command" /f
- :RestartEx
- Taskkill /im Explorer.exe /f >Nul
- Start Explorer.exe
- Exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement