Add or Remove 'Open in Windows Terminal as administrator' context menu  

Page 4 of 4 FirstFirst ... 234

  1. Posts : 1,746
    Windows 10 Pro x64 22H2
       #30

    That's really strange, I tried in standard account for several locations like, C:\, C:\Users\username\user etc. and also right clicking on specific folder instead of into folder space but not working in all cases.

    Since it's working for you I'm really out of luck it seems.
      My Computer


  2. Posts : 68,995
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #31

    zebal said:
    That's really strange, I tried in standard account for several locations like, C:\, C:\Users\username\user etc. and also right clicking on specific folder instead of into folder space but not working in all cases.

    Since it's working for you I'm really out of luck it seems.
    I must admit that I'm not sure why it's not working for you in a standard user.

    It'll be interesting it hear from others if they are seeing the same.
      My Computers


  3. Posts : 1,746
    Windows 10 Pro x64 22H2
       #32

    Brink said:
    You're most welcome.

    Using this below opened PowerShell v7 for me.

    @="powershell.exe -WindowStyle Hidden "Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','"""PowerShell"""','-d','"""%1"""')""
    Hello Brink, I see you didn't updated your initial code and reg file to add PS Core as an option...

    Here is how I modified your reg file and tested it:

    Code:
    [HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\004flyout]
    "MUIVerb"="PowerShell"
    "HasLUAShield"=""
    "Icon"="pwsh.exe"
    
    [HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\004flyout\command]
    @="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"PowerShell\"\"\"','-d','\"\"\"%2\\.\"\"\"')\""
    
    ; ...
    
    [HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\004flyout]
    "MUIVerb"="PowerShell"
    "HasLUAShield"=""
    "Icon"="pwsh.exe"
    
    [HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\004flyout\command]
    @="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"PowerShell\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""

    Btw. can you please explain the "-d" option value for wt.exe:

    Code:
    '-d','\"\"\"%V\\.\"\"\"'
    Code:
    '-d','\"\"\"%1\\.\"\"\"'
    Also is %2\. a valid directory?
    Code:
    '-d','\"\"\"%2\\.\"\"\"'
    I mean what is "%V\." and "%1\." referring to?
    I was looking at site below but couldn't find an answer:
    https://learn.microsoft.com/en-us/wi...line-arguments
      My Computer


  4. Posts : 68,995
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #33

    Hello @zebal,

    The -d option is to target a directory with the command.

    %v and %1 are variables used to capture the path for the command. I can't remember the exact specifics for each of these variables though.
      My Computers


  5. Posts : 1,746
    Windows 10 Pro x64 22H2
       #34

    Thanks, I have one additional question, below is screenshot of my context menu:

    Add or Remove 'Open in Windows Terminal as administrator' context menu-untitled.png

    The icon for "Open in Windows Terminal as Administrator" is a shield icon, do you know if it's possible to change this icon to the icon of Windows Terminal?

    Which line in the reg should be modified and to which value should "Icon" portion be set?
    Maybe you have some reference for icons in resource DLL's? if so I play around my self, but for now I have no idea.

    EDIT:
    I have tried the following:

    Code:
    [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWTHereAsAdmin]
    "HasLUAShield"=""
    "MUIVerb"="Open in Windows Terminal as administrator"
    "Extended"=-
    "SubCommands"=""
    "Icon"="wt.exe"
    But this doesn't work, it gives me default white program icon.
      My Computer


  6. Posts : 68,995
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #35

    zebal said:
    Thanks, I have one additional question, below is screenshot of my context menu:

    The icon for "Open in Windows Terminal as Administrator" is a shield icon, do you know if it's possible to change this icon to the icon of Windows Terminal?

    Which line in the reg should be modified and to which value should "Icon" portion be set?
    Maybe you have some reference for icons in resource DLL's? if so I play around my self, but for now I have no idea.

    EDIT:
    I have tried the following:

    Code:
    [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWTHereAsAdmin]
    "HasLUAShield"=""
    "MUIVerb"="Open in Windows Terminal as administrator"
    "Extended"=-
    "SubCommands"=""
    "Icon"="wt.exe"
    But this doesn't work, it gives me default white program icon.
    It's hard to find an ICO to use for a Store app. It's the main reason why I went with the UAC shield.

    You'll need to create a custom ICO for Windows Terminal. If needed, here are some 256x256 pixel PNG files for Windows Terminal you can use to create the ICO file to reference in the icon path instead.

    Add or Remove 'Open in Windows Terminal as administrator' context menu-windows_terminal.png

    Add or Remove 'Open in Windows Terminal as administrator' context menu-windows_terminal_elevated.png
      My Computers


  7. Posts : 1,746
    Windows 10 Pro x64 22H2
       #36

    @Brink

    Thanks a lot for icons and explanation, but I'm having issue referencing the icon, I've set:

    Code:
    "Icon"="C:\Users\Admin\Desktop\wt.png"
    and also tried:

    Code:
    "Icon"="C:\\Users\\Admin\\Desktop\\wt.png"
    But it's not working, I don't know the syntax for reg files so likely I'm doing something wrong.

    Add or Remove 'Open in Windows Terminal as administrator' context menu-untitled.png
      My Computer


  8. Posts : 68,995
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #37

    zebal said:
    @Brink

    Thanks a lot for icons and explanation, but I'm having issue referencing the icon, I've set:
    It'll need to be an ICO file instead of PNG.
      My Computers


  9. Posts : 1,746
    Windows 10 Pro x64 22H2
       #38

    Brink said:
    It'll need to be an ICO file instead of PNG.
    Ah, I see, silly me.
    Thank you a lot for helping me!

    EDIT:
    Btw. I found the ICO file here if anyone else will search it:
    Where can I find the Windows Terminal Icon? . Issue #7682 . microsoft/terminal . GitHub
      My Computer


  10. Posts : 68,995
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #39
      My Computers


 

Tutorial Categories

Add or Remove 'Open in Windows Terminal as administrator' context menu 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 Discussions
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 02:10.
Find Us




Windows 10 Forums