Open command window here as administrator - Add in Windows 10  

Page 12 of 13 FirstFirst ... 210111213 LastLast

  1. Posts : 17,401
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #110

    Hello @duckyshine,
    Welcome to TenForums.

    duckyshine said:
    Is it possible to run a program directly with cmd from the context menu?

    I don't know if this helps, but I have a Customised Toolbar with different folders, one of which has Batch Scripts. I just go to the folder and double-click the Batch Script that I want to run.

    I just thought that I would give you an alternative method.
      My Computer


  2. Posts : 11
    win10
       #111

    it will work, if i add this manually to the registry
    Code:
    powershell.exe -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs cmd.exe -ArgumentList \"/k \"\"%1\"\"\"
    but it doesnt, when i run it from a .reg file like this. The Key will not get added to the registry. I guess, its because wrong formation of the string. What do i need to change?
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\*\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "HasLUAShield"=""
    "Icon"="imageres.dll,-5323"
    
    [HKEY_CLASSES_ROOT\*\shell\OpenCmdHereAsAdmin\command]
    @="powershell.exe -WindowStyle Hidden -NoProfile -Command "Start-Process -Verb RunAs cmd.exe -ArgumentList \"/k \"\"%1\"\"\"
    Edit: This will work

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\*\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "HasLUAShield"=""
    "Icon"="imageres.dll,-5323"
    
    [HKEY_CLASSES_ROOT\*\shell\OpenCmdHereAsAdmin\command]
    @="powershell.exe -WindowStyle Hidden -NoProfile -Command \"Start-Process -Verb RunAs cmd.exe -ArgumentList \\\"/k \\\"\\\"%1\\\"\\\"\\\""
    Last edited by duckyshine; 07 Mar 2022 at 11:30.
      My Computer


  3. Posts : 1,100
    11 Home
       #112

    I added some minor cleanups to V5 so here's V5.01.

    Update:
    elecmd5_01.zip


    In addition, eleposh (elevated PowerShell) V2 is out:
    Add Open PowerShell window here as administrator in Windows 10
      My Computers


  4. Posts : 493
    Win7 Pro X64, Win10 Pro x640
       #113

    hdmi said:
    I added some minor cleanups to V5 so here's V5.01.

    Update:
    elecmd5_01.zip


    In addition, eleposh (elevated PowerShell) V2 is out:
    Add Open PowerShell window here as administrator in Windows 10
    What do the files in the archive do?
      My Computer


  5. Posts : 1,100
    11 Home
       #114

    bamajon1974 said:
    What do the files in the archive do?
    They are similar to this:
    Add Open PowerShell window here as administrator in Windows 10
    Only difference, the Command Prompt is opened in lieu of opening PowerShell 5.1, and, as a minor bonus, the Windows version info gets displayed in a human-friendly format on Windows 10/11.
      My Computers


  6. Posts : 493
    Win7 Pro X64, Win10 Pro x640
       #115

    hdmi said:
    They are similar to this:
    Add Open PowerShell window here as administrator in Windows 10
    Only difference, the Command Prompt is opened in lieu of opening PowerShell 5.1, and, as a minor bonus, the Windows version info gets displayed in a human-friendly format on Windows 10/11.
    Thank you for the clarification. I replied to the powershell window thread.
      My Computer


  7. Posts : 87
    Windows 10 X64 Home
       #116

    I have a folders on my D:\..... it's name contain the " 's " strings and Open Command windows as admin it's not works.....

    The path it's "D:\Randal's Monday" it's fixable ?
      My Computer


  8. Posts : 17,401
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #117

    Hello @DjDiabolik,

    Did you Restart the computer ?
      My Computer


  9. Posts : 64,499
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #118

    DjDiabolik said:
    I have a folders on my D:\..... it's name contain the " 's " strings and Open Command windows as admin it's not works.....

    The path it's "D:\Randal's Monday" it's fixable ?
    Hello,

    Personally, I find it best to avoid having characters like an apostrophe in a file/folder/drive name to avoid such issues.
      My Computers


  10. Posts : 1,100
    11 Home
       #119

    DjDiabolik said:
    I have a folders on my D:\..... it's name contain the " 's " strings and Open Command windows as admin it's not works.....

    The path it's "D:\Randal's Monday" it's fixable ?
    I already did fix it, a very long time ago. See:
    Open command window here as administrator - Add in Windows 10

    How it works:
    Just extract (unzip) the folder so it will be C:\tools\elecmd and open that folder in File Explorer. There's a file README.txt with a full explanation, basically all you need to set it up is to create a new task in Task Scheduler and run a few scripts.

    To create this task in Task Scheduler, please refer to OPTION TWO in this tutorial:
    Create Elevated Shortcut without UAC prompt in Windows 10
    Below are the steps that need to be modified to make it function correctly for our own intended purpose.

    Step 3, the name of the task needs to match the name that's found near the bottom of the elecmd.vbs scriptfile:
    cmd - elevated

    Step 7, under Program/script, enter the following command:
    %windir%\System32\wscript.exe

    Step 8, under Arguments, enter the full filepath to the elecmdstart.vbs scriptfile, using doublequotes:
    "C:\tools\elecmd\elecmdstart.vbs"

    Steps 12 - 20, this whole part needs to be skipped.

    Finally, run the script file C:\tools\elecmd\Add_Shortcuts.vbs and also run the batchfile C:\tools\elecmd\Add_Shift+Open_cmd_window_here_as_admin_without_UAC.bat so now your Shift + right-click menu has an option to Open (without showing the UAC prompt) command window here as administrator.
    There's also a batchfile C:\tools\elecmd\Add_Shift+Open_cmd_window_here.bat that adds an option to Open command window here (as a normal user) if you like. For convenience, for those who prefer to use a .reg file (instead of a batchfile) for applying these changes to the Windows registry, I have included them both, and, for those who wish to remove (undo) these changes from the Windows registry, I have included the .reg files for that too.

    Please just let me know if you have questions.
      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 17:40.
Find Us




Windows 10 Forums