Created
December 12, 2019 06:14
-
-
Save caphosra/e0765d672a0ec8da07151abbcfa5f826 to your computer and use it in GitHub Desktop.
Implementation of sudo command on Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A function that runs some commands with administrator rights. | |
| function SudoRun | |
| { | |
| # Set commands to $program. | |
| foreach($arg in $args) | |
| { | |
| $program = "$program $arg" | |
| } | |
| # Run it by Powershell with administrator rights. | |
| pwsh -command "Start-Process -Verb runas $program" | |
| } | |
| # Set the function as an new alias. | |
| Set-Alias -Name sudo -Value SudoRun |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment