Jump to content
  • How to run elevated commands with Sudo on Windows 11 2024 Update (version 24H2)


    Karlston

    • 135 views
    • 4 minutes
     Share


    • 135 views
    • 4 minutes

    Yes, after this many years, you can run elevated commands with Sudo on Windows 11.

    Starting with the release of the Windows 11 2024 Update (version 24H2), Microsoft is introducing a Linux-like version of the Sudo (superuser do) command that works in any of the consoles of the Windows Terminal, including Command Prompt and PowerShell.

     

    Usually, when you have to run an elevated command, you right-click the Windows Terminal from the Start menu or Taskbar, choose the "Run as administrator" option, and then run the command. Other times, you open the terminal as a standard user, and once you run the command and receive the "Access is denied" message, you relaunch the terminal as administrator to execute the command successfully. 

     

    The Sudo command for Windows 11 streamlines the process by elevating any command without the extra steps of opening a command-line console as admin.

     

    Although Microsoft could have chosen a different approach and name for the command, the company wanted to integrate an experience similar to UNIX-based operating systems to avoid an additional learning curb. 

     

    If you want to use the feature, you will have to enable and configure it manually, and the easiest way is to use the Settings app.

     

    In this how-to guide, I will share the steps to enable the Sudo command and run elevated commands.

    Disclaimer
     

    Important: The Windows 11 2024 Update is expected to become partially available on June 18, 2024, for Copilot+ PCs, but it won't include all the intended features, including Windows Recall, as it has been postponed until further notice. In September or October, the feature update will become more broadly available for existing devices. As a result, some of the new features and changes may not be available to everyone on day one. Also, some features (especially AI features) may require new hardware to be available.

    How to configure Sudo on Windows 11

    To turn on the Sudo command, use these steps:

     
    1. Open Settings.
    2. Click on System.
    3. Click the For developers page on the right side.

     

    Pj64bAD5jfDxtW4CqXN48M-970-80.jpg

    (Image credit: Mauro Huculak)

     

    1. Turn on the Enable sudo toggle switch.
    2. Click the sudo setting to reveal the available option.

     

    RBQKBmXXW2Ai2bK7cxhWhY-970-80.jpg

    (Image credit: Mauro Huculak)

     

    1. Click the sudo setting to reveal the available option.
    2. Select the sudo behavior with the "Configure how sudo runs applications" setting:
    • Inline: The command runs in the same window, identical to Linux and macOS.
    • With input disabled: The command runs in a new window but doesn't accept additional inputs. 
    • In a new window: The command triggers a new, elevated window.

     

    s63AKSuK3CmuBqdMRsYbpe-970-80.jpg

    (Image credit: Mauro Huculak)

     

    Once you complete the steps, you can use the Command Prompt or PowerShell with a standard session and run elevated commands with the Sudo command.

    How to run command with Sudo on Windows 11

    To run commands as an administrator with Sudo is a straightforward process:

     

    1. Open Start.
    2. Search for Command Prompt (or PowerShell) and click the top result to open the console.
    3. Type the following example to use the Sudo command and press Enter: sudo COMMAND-SYNTAX

     

    In the command, change "COMMAND-SYNTAX" for the command you want to run elevated. For example, this command renames a text to "mycode.txt" in the root of "C" that usually requires elevation: sudo ren codefile.txt mycode.txt

     

    Mpvjk8AnSM24ZhnRaAku79-970-80.jpg

    (Image credit: Mauro Huculak)

     

    After you complete the steps, the command will run elevated from the standard console.

     

    rU8qLerzkRYTgfexRfhQR9-970-80.jpg

    (Image credit: Mauro Huculak)

     

    It's important to note that the Sudo version for Windows 11 allows you to delete protected files, run commands that require elevation, and open new sessions to perform different tasks. However, it's limited compared to the version for Linux. For example, the Linux version includes around 29 options.

     

    fjZJyGNkHhQTx7Jd3VR3LD-970-80.jpg

    (Image credit: Mauro Huculak)

     

    On the other hand, the one for Windows 11 only includes seven options.

     

    Source

     

    Hope you enjoyed this news post.

    Thank you for appreciating my time and effort posting news every single day for many years.

    2023: Over 5,800 news posts | 2024 (till end of May): Nearly 2,400 news posts


    User Feedback

    Recommended Comments

    There are no comments to display.



    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...