Skip to content

Instantly share code, notes, and snippets.

@kapb14
Created October 21, 2015 17:00
Show Gist options
  • Save kapb14/73121937ad36a50de271 to your computer and use it in GitHub Desktop.
Save kapb14/73121937ad36a50de271 to your computer and use it in GitHub Desktop.
simplest "sudo" for Windows
:: save this file as "sudo.cmd" and place it in your %PATH%
@echo Set objShell = CreateObject("Shell.Application") > %temp%\sudo.tmp.vbs
@echo args = Right("%*", (Len("%*") - Len("%1"))) >> %temp%\sudo.tmp.vbs
@echo objShell.ShellExecute "%1", args, "", "runas" >> %temp%\sudo.tmp.vbs
@cscript %temp%\sudo.tmp.vbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment