Add PsExec to Windows 10 Context Menu

Page 1 of 2 12 LastLast

  1. Posts : 12
    Windows 10 Enterprise S
       #1

    Add PsExec to Windows 10 Context Menu


    Hello,

    I can run the command prompt as admin from the context menu. Is it possible to run the command prompt as SYSTEM from the context menu? I currently use PsExec from the Systernal Suite to run CMD as SYSTEM but I have not figured out a way to add that to the context menu that keeps the CMD open.

    I haven't found a working solution anywhere.

    I have created a desktop shortcut using
    Code:
    C:\Windows\System32\PsExec.exe -s -i -d -w %HOMEDRIVE% -high %windir%\system32\cmd.exe /k
    as the target. It works. Just have run as admin.

    This what I have in the registry so far:

    Code:
    [HKEY_CLASSES_ROOT\LibraryFolder\Shell\OpenSysCmd]@="Command Prompt (Sys)""NoWorkingDirectory"="""NeverDefault"="""Icon"="imageres.dll,-5324"[HKEY_CLASSES_ROOT\LibraryFolder\Shell\OpenSysCmd\command]@="\"C:\\Windows\\System32\\PsExec.exe\" -s -i -d -w %HOMEDRIVE% -high %windir%\\system32\\cmd.exe /k\""
    The same is added to:
    HKEY_CLASSES_ROOT\Drive\shell\
    HKEY_CLASSES_ROOT\Directory\shell\
    HKEY_CLASSES_ROOT\Directory\background\shell\

    It adds the menu item.
    Add PsExec to Windows 10 Context Menu-cap.fw.png

    Like I said... it works but it doesn't keep the window open. A quick flash and the windows closes.

    Thanks
      My Computer


  2. Posts : 42,985
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, I'm reminded of what I did here for someone - maybe it will suggest an idea...
    Open Notepad as Administrator with Context Menu? Solved - Windows 10 Forums
    From #8
      My Computers


  3. Posts : 17,838
    Windows 10
       #3

    @MasTech

    You could add WinX Classic Context Menu to HKEY_CLASSES_ROOT/Directory:

    Add Win+X Classic Menu to Context Menu in Windows 10 Customization Tutorials
      My Computer


  4. Posts : 12
    Windows 10 Enterprise S
    Thread Starter
       #4

    Okay. Still no progress. I will keep searching trying. Thanks for the suggestions.
      My Computer


  5. Posts : 42,985
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #5

    Is this what you wanted?
    Add PsExec to Windows 10 Context Menu-untitled.png
      My Computers


  6. Posts : 12
    Windows 10 Enterprise S
    Thread Starter
       #6

    That would a huge YES. I have the context menu in place. The command executes when clicked. The CMD prompt opens and closes in a flash though.
      My Computer


  7. Posts : 12
    Windows 10 Enterprise S
    Thread Starter
       #7

    @dalchina

    That would a huge YES. I have the context menu in place. The command executes when clicked. The CMD prompt opens and closes in a flash though.
      My Computer


  8. Posts : 42,985
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #8

    OK, please follow the procedure I outlined in my first post.

    The ahk file contains (from your post)
    Run, *runas "D:\Utilities\Sysinternals Suite\PsExec.exe" -s -i -d -w %HOMEDRIVE% -high %windir%\system32\cmd.exe /k
    exit

    Download, install and run Autohotkey, rt click and compile the ahk file to get what I've attached.

    (Note - there's no parameter in this example.. you could develop this so the command prompt launches open at the right place I guess).

    Here I used the same program (for convenience) to add the context menu entry:
    Add PsExec to Windows 10 Context Menu-1.png

    Add PsExec to Windows 10 Context Menu-1.jpg
    Add PsExec to Windows 10 Context Menu Attached Files
    Last edited by dalchina; 24 Oct 2017 at 16:08.
      My Computers


  9. Posts : 12
    Windows 10 Enterprise S
    Thread Starter
       #9

    @dalchina

    Um. Where is the first post. I see where you asked about my goal then the post with the attachment
      My Computer


  10. Posts : 42,985
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #10

    What I've provided for you was done in the same way as per the link in my #2.
      My Computers


 

  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 00:16.
Find Us




Windows 10 Forums