Add 'Open Powershell here as admin' option to folder context menu












14















I have been looking for a way to open an elevated Powershell prompt from Windows Explorer directly, via the context menu of the folder I want to open the prompt in.

I'm using Windows 10 and all the examples I've seen so far have been for older versions of Windows. I previously had this working on Windows 8.1, but the update to 10 broke it. I even got this working on Windows 10 briefly, but an update broke it again (Dec 2015).



Does anyone know the correct way to add this feature to Windows? Or is it doomed to be overwritten by future updates to Windows?










share|improve this question



























    14















    I have been looking for a way to open an elevated Powershell prompt from Windows Explorer directly, via the context menu of the folder I want to open the prompt in.

    I'm using Windows 10 and all the examples I've seen so far have been for older versions of Windows. I previously had this working on Windows 8.1, but the update to 10 broke it. I even got this working on Windows 10 briefly, but an update broke it again (Dec 2015).



    Does anyone know the correct way to add this feature to Windows? Or is it doomed to be overwritten by future updates to Windows?










    share|improve this question

























      14












      14








      14


      8






      I have been looking for a way to open an elevated Powershell prompt from Windows Explorer directly, via the context menu of the folder I want to open the prompt in.

      I'm using Windows 10 and all the examples I've seen so far have been for older versions of Windows. I previously had this working on Windows 8.1, but the update to 10 broke it. I even got this working on Windows 10 briefly, but an update broke it again (Dec 2015).



      Does anyone know the correct way to add this feature to Windows? Or is it doomed to be overwritten by future updates to Windows?










      share|improve this question














      I have been looking for a way to open an elevated Powershell prompt from Windows Explorer directly, via the context menu of the folder I want to open the prompt in.

      I'm using Windows 10 and all the examples I've seen so far have been for older versions of Windows. I previously had this working on Windows 8.1, but the update to 10 broke it. I even got this working on Windows 10 briefly, but an update broke it again (Dec 2015).



      Does anyone know the correct way to add this feature to Windows? Or is it doomed to be overwritten by future updates to Windows?







      windows-10 powershell






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 16 '15 at 14:39









      AstravagrantAstravagrant

      8151918




      8151918






















          3 Answers
          3






          active

          oldest

          votes


















          19














          This is the only way I know of to currently add this feature to context menus in Windows Explorer:



          [Run this script in an elevated powershell prompt]



          $menu = 'Open Windows PowerShell Here as Administrator'
          $command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

          'directory', 'directorybackground', 'drive' | ForEach-Object {
          New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
          Set-ItemProperty -Name '(default)' -Value $command -PassThru |
          Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
          Set-ItemProperty -Name HasLUAShield -Value ''
          }


          This script taken from the following link:



          http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/



          I'm 99% certain that this was the way I did it before the latest Windows patch 'removed' my registry setting (it also removed some other customisations, like numlock boot status, but that is less annoying).



          If anyone knows a better approach; i.e. that won't be volatile, then please let me know and I'll accept that answer.






          share|improve this answer



















          • 1





            Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

            – Deadly-Bagel
            Jan 5 '16 at 16:44






          • 4





            Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

            – Ian Kemp
            Jul 26 '16 at 13:05



















          2














          I've been doing it like this. It is part of a little menu I made. Edit it to your liking:



          [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerCommandStoreshellOAPS.Tools]
          "ImpliedSelectionModel"=dword:00000001
          "Icon"="imageres.dll,-5373"
          "ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
          @="Admin Pshell Here"





          share|improve this answer

































            0














            Here is a copy of the reg file I use to add both CMD and POWERSHELL to the BACKGROUND context menu of any folder in Windows 10:



            Windows Registry Editor Version 5.00

            ;Add_Open_CMD_and_Powershell_to_Context_Menu.reg

            ;Right-Click Background only

            ;CMD Prompt

            [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

            [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopen] "MUIVerb"="Command Prompt" "Icon"="cmd.exe"

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopencommand] @="cmd.exe /s /k pushd "%V""

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunas] "MUIVerb"="Command Prompt Elevated" "Icon"="cmd.exe" "HasLUAShield"=""

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunascommand] @="cmd.exe /s /k pushd "%V""

            ; PowerShell

            [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

            [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopen] "MUIVerb"="PowerShell" "Icon"="powershell.exe"

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopencommand] @="powershell.exe -noexit -command Set-Location '%V'"

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunas] "MUIVerb"="PowerShell Elevated" "Icon"="powershell.exe" "HasLUAShield"=""

            [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunascommand] @="powershell.exe -noexit -command Set-Location '%V'"







            share|improve this answer


























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "3"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1014208%2fadd-open-powershell-here-as-admin-option-to-folder-context-menu%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              19














              This is the only way I know of to currently add this feature to context menus in Windows Explorer:



              [Run this script in an elevated powershell prompt]



              $menu = 'Open Windows PowerShell Here as Administrator'
              $command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

              'directory', 'directorybackground', 'drive' | ForEach-Object {
              New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
              Set-ItemProperty -Name '(default)' -Value $command -PassThru |
              Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
              Set-ItemProperty -Name HasLUAShield -Value ''
              }


              This script taken from the following link:



              http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/



              I'm 99% certain that this was the way I did it before the latest Windows patch 'removed' my registry setting (it also removed some other customisations, like numlock boot status, but that is less annoying).



              If anyone knows a better approach; i.e. that won't be volatile, then please let me know and I'll accept that answer.






              share|improve this answer



















              • 1





                Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

                – Deadly-Bagel
                Jan 5 '16 at 16:44






              • 4





                Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

                – Ian Kemp
                Jul 26 '16 at 13:05
















              19














              This is the only way I know of to currently add this feature to context menus in Windows Explorer:



              [Run this script in an elevated powershell prompt]



              $menu = 'Open Windows PowerShell Here as Administrator'
              $command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

              'directory', 'directorybackground', 'drive' | ForEach-Object {
              New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
              Set-ItemProperty -Name '(default)' -Value $command -PassThru |
              Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
              Set-ItemProperty -Name HasLUAShield -Value ''
              }


              This script taken from the following link:



              http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/



              I'm 99% certain that this was the way I did it before the latest Windows patch 'removed' my registry setting (it also removed some other customisations, like numlock boot status, but that is less annoying).



              If anyone knows a better approach; i.e. that won't be volatile, then please let me know and I'll accept that answer.






              share|improve this answer



















              • 1





                Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

                – Deadly-Bagel
                Jan 5 '16 at 16:44






              • 4





                Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

                – Ian Kemp
                Jul 26 '16 at 13:05














              19












              19








              19







              This is the only way I know of to currently add this feature to context menus in Windows Explorer:



              [Run this script in an elevated powershell prompt]



              $menu = 'Open Windows PowerShell Here as Administrator'
              $command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

              'directory', 'directorybackground', 'drive' | ForEach-Object {
              New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
              Set-ItemProperty -Name '(default)' -Value $command -PassThru |
              Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
              Set-ItemProperty -Name HasLUAShield -Value ''
              }


              This script taken from the following link:



              http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/



              I'm 99% certain that this was the way I did it before the latest Windows patch 'removed' my registry setting (it also removed some other customisations, like numlock boot status, but that is less annoying).



              If anyone knows a better approach; i.e. that won't be volatile, then please let me know and I'll accept that answer.






              share|improve this answer













              This is the only way I know of to currently add this feature to context menus in Windows Explorer:



              [Run this script in an elevated powershell prompt]



              $menu = 'Open Windows PowerShell Here as Administrator'
              $command = "$PSHOMEpowershell.exe -NoExit -NoProfile -Command ""Set-Location '%V'"""

              'directory', 'directorybackground', 'drive' | ForEach-Object {
              New-Item -Path "Registry::HKEY_CLASSES_ROOT$_shell" -Name runascommand -Force |
              Set-ItemProperty -Name '(default)' -Value $command -PassThru |
              Set-ItemProperty -Path {$_.PSParentPath} -Name '(default)' -Value $menu -PassThru |
              Set-ItemProperty -Name HasLUAShield -Value ''
              }


              This script taken from the following link:



              http://www.powershellmagazine.com/2013/06/25/pstip-how-to-start-an-elevated-powershell-from-windows-explorer/



              I'm 99% certain that this was the way I did it before the latest Windows patch 'removed' my registry setting (it also removed some other customisations, like numlock boot status, but that is less annoying).



              If anyone knows a better approach; i.e. that won't be volatile, then please let me know and I'll accept that answer.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 16 '15 at 14:43









              AstravagrantAstravagrant

              8151918




              8151918








              • 1





                Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

                – Deadly-Bagel
                Jan 5 '16 at 16:44






              • 4





                Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

                – Ian Kemp
                Jul 26 '16 at 13:05














              • 1





                Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

                – Deadly-Bagel
                Jan 5 '16 at 16:44






              • 4





                Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

                – Ian Kemp
                Jul 26 '16 at 13:05








              1




              1





              Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

              – Deadly-Bagel
              Jan 5 '16 at 16:44





              Windows 10 certainly is a pain with UAC. Even "disabled" it's a constant headache ._. The only reason I haven't gone back to Windows 7 is because I now have 4 screens.

              – Deadly-Bagel
              Jan 5 '16 at 16:44




              4




              4





              Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

              – Ian Kemp
              Jul 26 '16 at 13:05





              Remove the -NoProfile switch to get your profile loaded automatically when you launch the prompt.

              – Ian Kemp
              Jul 26 '16 at 13:05













              2














              I've been doing it like this. It is part of a little menu I made. Edit it to your liking:



              [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerCommandStoreshellOAPS.Tools]
              "ImpliedSelectionModel"=dword:00000001
              "Icon"="imageres.dll,-5373"
              "ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
              @="Admin Pshell Here"





              share|improve this answer






























                2














                I've been doing it like this. It is part of a little menu I made. Edit it to your liking:



                [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerCommandStoreshellOAPS.Tools]
                "ImpliedSelectionModel"=dword:00000001
                "Icon"="imageres.dll,-5373"
                "ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
                @="Admin Pshell Here"





                share|improve this answer




























                  2












                  2








                  2







                  I've been doing it like this. It is part of a little menu I made. Edit it to your liking:



                  [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerCommandStoreshellOAPS.Tools]
                  "ImpliedSelectionModel"=dword:00000001
                  "Icon"="imageres.dll,-5373"
                  "ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
                  @="Admin Pshell Here"





                  share|improve this answer















                  I've been doing it like this. It is part of a little menu I made. Edit it to your liking:



                  [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerCommandStoreshellOAPS.Tools]
                  "ImpliedSelectionModel"=dword:00000001
                  "Icon"="imageres.dll,-5373"
                  "ExplorerCommandHandler"="{BF0AC53F-D51C-419F-92E3-2298E125F004}"
                  @="Admin Pshell Here"






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited May 8 '17 at 11:57









                  Burgi

                  4,441102945




                  4,441102945










                  answered May 8 '17 at 8:56









                  pbanjpbanj

                  211




                  211























                      0














                      Here is a copy of the reg file I use to add both CMD and POWERSHELL to the BACKGROUND context menu of any folder in Windows 10:



                      Windows Registry Editor Version 5.00

                      ;Add_Open_CMD_and_Powershell_to_Context_Menu.reg

                      ;Right-Click Background only

                      ;CMD Prompt

                      [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopen] "MUIVerb"="Command Prompt" "Icon"="cmd.exe"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopencommand] @="cmd.exe /s /k pushd "%V""

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunas] "MUIVerb"="Command Prompt Elevated" "Icon"="cmd.exe" "HasLUAShield"=""

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunascommand] @="cmd.exe /s /k pushd "%V""

                      ; PowerShell

                      [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopen] "MUIVerb"="PowerShell" "Icon"="powershell.exe"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopencommand] @="powershell.exe -noexit -command Set-Location '%V'"

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunas] "MUIVerb"="PowerShell Elevated" "Icon"="powershell.exe" "HasLUAShield"=""

                      [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunascommand] @="powershell.exe -noexit -command Set-Location '%V'"







                      share|improve this answer






























                        0














                        Here is a copy of the reg file I use to add both CMD and POWERSHELL to the BACKGROUND context menu of any folder in Windows 10:



                        Windows Registry Editor Version 5.00

                        ;Add_Open_CMD_and_Powershell_to_Context_Menu.reg

                        ;Right-Click Background only

                        ;CMD Prompt

                        [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopen] "MUIVerb"="Command Prompt" "Icon"="cmd.exe"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopencommand] @="cmd.exe /s /k pushd "%V""

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunas] "MUIVerb"="Command Prompt Elevated" "Icon"="cmd.exe" "HasLUAShield"=""

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunascommand] @="cmd.exe /s /k pushd "%V""

                        ; PowerShell

                        [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopen] "MUIVerb"="PowerShell" "Icon"="powershell.exe"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopencommand] @="powershell.exe -noexit -command Set-Location '%V'"

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunas] "MUIVerb"="PowerShell Elevated" "Icon"="powershell.exe" "HasLUAShield"=""

                        [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunascommand] @="powershell.exe -noexit -command Set-Location '%V'"







                        share|improve this answer




























                          0












                          0








                          0







                          Here is a copy of the reg file I use to add both CMD and POWERSHELL to the BACKGROUND context menu of any folder in Windows 10:



                          Windows Registry Editor Version 5.00

                          ;Add_Open_CMD_and_Powershell_to_Context_Menu.reg

                          ;Right-Click Background only

                          ;CMD Prompt

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopen] "MUIVerb"="Command Prompt" "Icon"="cmd.exe"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopencommand] @="cmd.exe /s /k pushd "%V""

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunas] "MUIVerb"="Command Prompt Elevated" "Icon"="cmd.exe" "HasLUAShield"=""

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunascommand] @="cmd.exe /s /k pushd "%V""

                          ; PowerShell

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopen] "MUIVerb"="PowerShell" "Icon"="powershell.exe"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopencommand] @="powershell.exe -noexit -command Set-Location '%V'"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunas] "MUIVerb"="PowerShell Elevated" "Icon"="powershell.exe" "HasLUAShield"=""

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunascommand] @="powershell.exe -noexit -command Set-Location '%V'"







                          share|improve this answer















                          Here is a copy of the reg file I use to add both CMD and POWERSHELL to the BACKGROUND context menu of any folder in Windows 10:



                          Windows Registry Editor Version 5.00

                          ;Add_Open_CMD_and_Powershell_to_Context_Menu.reg

                          ;Right-Click Background only

                          ;CMD Prompt

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell1MenuCmd] "MUIVerb"="Command Prompts" "Icon"="cmd.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuCmd"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopen] "MUIVerb"="Command Prompt" "Icon"="cmd.exe"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellopencommand] @="cmd.exe /s /k pushd "%V""

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunas] "MUIVerb"="Command Prompt Elevated" "Icon"="cmd.exe" "HasLUAShield"=""

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuCmdshellrunascommand] @="cmd.exe /s /k pushd "%V""

                          ; PowerShell

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundshell2MenuPowerShell] "MUIVerb"="PowerShell Prompts" "Icon"="powershell.exe" "ExtendedSubCommandsKey"="DirectoryBackgroundContextMenusMenuPowerShell"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopen] "MUIVerb"="PowerShell" "Icon"="powershell.exe"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellopencommand] @="powershell.exe -noexit -command Set-Location '%V'"

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunas] "MUIVerb"="PowerShell Elevated" "Icon"="powershell.exe" "HasLUAShield"=""

                          [HKEY_CLASSES_ROOTDirectoryBackgroundContextMenusMenuPowerShellshellrunascommand] @="powershell.exe -noexit -command Set-Location '%V'"








                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Feb 24 at 13:36









                          NickSlash

                          1084




                          1084










                          answered Mar 18 '18 at 5:14









                          bobkushbobkush

                          29128




                          29128






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Super User!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1014208%2fadd-open-powershell-here-as-admin-option-to-folder-context-menu%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Probability when a professor distributes a quiz and homework assignment to a class of n students.

                              Aardman Animations

                              Are they similar matrix