Skip to content

Instantly share code, notes, and snippets.

@raspiduino
Last active December 15, 2020 16:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raspiduino/eb1462f4abb7dbd544d2f22d21c9326f to your computer and use it in GitHub Desktop.
Save raspiduino/eb1462f4abb7dbd544d2f22d21c9326f to your computer and use it in GitHub Desktop.
Sudo command for cmd

Sudo command for cmd

What is this?

In Linux, we can use sudo to run command as root. In Windows, we can use runas command to do that, but it doesn't support for empty password file! So we make this small macro for you to do the same thing as sudo for Windows.

How to use this?

Install this macro:

doskey sudo=start /min powershell -Command "Start-Process $* -Verb runAs"

Using this macro: sudo + program name (in PATH)
When you use this macro, you will have a popup UAC prompt displayed.

Requirement

  • Powershell

Note

You have to redefine this everytime you need this. If you want to automaticly define this, please refer to this StackOverFlow post.

Todo

  • Auto save macro without redefine everytime need to use this.
@raspiduino
Copy link
Author

Have fun with your sudo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment