Open Bash window here as administrator - Add in Windows 10  

Page 1 of 3 123 LastLast
    Open Bash window here as administrator - Add in Windows 10

    Open Bash window here as administrator - Add in Windows 10

    How to Add 'Open Bash window here as administrator' context menu in Windows 10
    Published by Category: Customization
    26 Feb 2020
    Designer Media Ltd


    How to Add 'Open Bash window here as administrator' context menu in Windows 10


    Microsoft first made investments that improve cmd, PowerShell, and many other command-line tools and developer scenarios. Second Microsoft decided to grow their command line family by adding real, native Bash and with it support for Linux command-line tools which run directly on Windows in an environment that behaves like Linux!

    Starting with Windows 10 Insider Preview Build 14316, you can natively run Bash in Windows. BASH is a popular text-based shell and command-language. It is the default shell included within Ubuntu and other Linux distroís, and in OSX. Users type commands into a shell to execute scripts and/or run commands and tools to accomplish many tasks.

    You can now run Bash scripts, Linux command-line tools like sed, awk, grep, and you can even try Linux-first tools like Ruby, Git, Python, etc. directly on Windows. You can also access your Windows filesystem from within Bash allowing you to work on the same set of files using your preferred Windows tools or Linux command-line tools.

    For more details about Bash, see:

    This tutorial will show you how to add or remove a Open Bash window here as administrator context menu for all users in Windows 10.

    You must be signed in as an administrator to add, remove, or use the "Open Bash window here as administrator" context menu.

    The "Open Bash window here" context menu item requires that Bash on Unbunto is enabled to work. Bash on Unbunto is not enabled by default in Windows 10.

    The "Open Bash window here" context menu will be available when you right click or shift + right click on a folder or drive, and when you right click or shift + right click on the background of a folder, drive, library, or desktop.



    EXAMPLE: "Open Bash window here as administrator" context menu
    Open Bash window here as administrator - Add in Windows 10-open_bash_window_here_as_administrator_context_menu.png
    Open Bash window here as administrator - Add in Windows 10-bash_on_ubuntu_on_windows.png



    Here's How:

    1 Do step 2 (add-right click), step 3 (add-Shift+right click) , or step 4 (remove) below for what you would like to do.


    2 To Add Right Click "Open Bash window here as administrator" Context Menu

    A) Click/tap on the Download button below to download the file below, and go to step 5 below.

    Add_Open_Bash_window_here_as_administrator_context_menu.reg

    Download


    3 To Add Shift + Right Click "Open Bash window here as administrator" Context Menu

    A) Click/tap on the Download button below to download the file below, and go to step 5 below.

    Add_Shiift+Open_Bash_window_here_as_administrator_context_menu.reg

    Download


    4 To Remove "Open Bash window here as administrator" Context Menu

    This is the default setting.

    A) Click/tap on the Download button below to download the file below, and go to step 5 below.

    Remove_Open_Bash_window_here_as_administrator_context_menu.reg

    Download


    5 Save the .reg file to your desktop.

    6 Double click/tap on the downloaded .reg file to merge it.

    7 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

    8 You can now delete the downloaded .reg file if you like.


    That's it,
    Shawn




  1. Posts : 663
    Windows 10 x64 Pro
       #1

    Hi again brink :)

    It possible to make this without the shield icon? Perhaps with the bash icon? Iíd swoon!
      My Computer

  2. Brink's Avatar
    Posts : 48,806
    64-bit Windows 10 Pro for Workstations build 19635
    Thread Starter
       #2

    Hello klepp, :)

    Here's one without the UAC icon.

    Add_Open_Bash_window_here_as_administrator_context_menu.reg
      My Computers

  3. Mystere's Avatar
    Posts : 3,223
    Windows 10 Pro
       #3

    The Shield Icon means it requires administrator privs. It can't (to my knowledge) be set to something else without replacing it globally (ie some kind of imgres replacement) . You can remove the admin privs, as Brink has done, but you can't use a custom icon.
      My Computer

  4. Brink's Avatar
    Posts : 48,806
    64-bit Windows 10 Pro for Workstations build 19635
    Thread Starter
       #4

    The icon in the context menu can be any icon you want, or can be removed. It won't affect it from running as administrator. :)
      My Computers


  5. Posts : 663
    Windows 10 x64 Pro
       #5

    You are the man :)

    Thank you!

    Any chance thereís a tutorial around about how to change the icon? Appreciate your removing the shield for me :)

    If i can add the bash icon and learn something along the way that would be great.

    #bow
      My Computer

  6. Brink's Avatar
    Posts : 48,806
    64-bit Windows 10 Pro for Workstations build 19635
    Thread Starter
       #6

    You're most welcome.

    You can edit the .reg file, add the "Icon" lines, and replace the bit in red below with the full path of the .ico file you want to use.

    Code:
    Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\BashAsAdmin]
    @="Open Bash window here as administrator"
    "Extended"=-
    "HasLUAShield"=-
    "Icon"="full path of .ico file"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\BashAsAdmin\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && bash.exe' -Verb RunAs\""
    
    
    [HKEY_CLASSES_ROOT\Directory\shell\BashAsAdmin]
    @="Open Bash window here as administrator"
    "Extended"=-
    "HasLUAShield"=-
    "Icon"="full path of .ico file"
    
    [HKEY_CLASSES_ROOT\Directory\shell\BashAsAdmin\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && bash.exe' -Verb RunAs\""
    
    
    [HKEY_CLASSES_ROOT\Drive\shell\BashAsAdmin]
    @="Open Bash window here as administrator"
    "Extended"=-
    "HasLUAShield"=-
    "Icon"="full path of .ico file"
    
    [HKEY_CLASSES_ROOT\Drive\shell\BashAsAdmin\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && bash.exe' -Verb RunAs\""
    
    
    [HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\BashAsAdmin]
    @="Open Bash window here as administrator"
    "Extended"=-
    "HasLUAShield"=-
    "Icon"="full path of .ico file"
    
    [HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\BashAsAdmin\command]
    @="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && bash.exe' -Verb RunAs\""
    Last edited by Brink; 19 Mar 2018 at 09:18. Reason: updated
      My Computers



  7. Posts : 663
    Windows 10 x64 Pro
       #7

    I feel guilty for bugging you, I apologize!

    First thing in the morning Iíll see if I canít find where windows stashes that little red three circle icon and it should be easy peasy beyond that.

    Sincere gratitude :)
      My Computer


  8. Posts : 663
    Windows 10 x64 Pro
       #8

    found it! for those interested

    "C:\\Program Files\\WindowsApps\\CanonicalGroupLimited.UbuntuonWindows_1604.2017.922.0_x64__79rhkp1fndgsc\\images \\icon.ico"

    Thanks brink :)
    Last edited by klepp0906; 19 Mar 2018 at 06:30.
      My Computer


  9. Posts : 663
    Windows 10 x64 Pro
       #9

    hrm I get

    cannot import (path to file): The specified file is not a registry script. You can only import binary registry files from within the registry editor.

    EDIT - fixed. Has to have Windows Registry Editor Version 5.00 header, didnt realize that was integral :)
      My Computer


 

Tutorial Categories

Open Bash window here as administrator - Add in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


Related Threads
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:28.
Find Us




Windows 10 Forums