Created
October 27, 2020 09:25
-
-
Save tackme31/78f6a73d4cdcf3be8961aa19c0598b4f to your computer and use it in GitHub Desktop.
A sudo-like command for 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
| function Invoke-AsAdmin() { | |
| if($args.count -eq 0){ | |
| Start-Process -Verb runas powershell | |
| } | |
| else { | |
| Start-Process -Verb runas -ArgumentList @('-command', "cd $(Get-Location); $($args -join ' ')") powershell | |
| } | |
| } | |
| Set-Alias -Name sudo -Value Invoke-AsAdmin -Option None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment