Home » Questions » Computers [ Ask a new question ]

On Windows 7, is there a command prompt line that can start cmd as an administrator? [duplicate]

On Windows 7, is there a command prompt line that can start cmd as an administrator? [duplicate]

On Linux, we can use

Asked by: Guest | Views: 524
Total answers/comments: 6
Guest [Entry]

"The runas command is the closest thing to what you're looking for:

runas /user:username cmd.exe

The format is runas, the username you want to run as, other options, and then the program you want to run.

If you're on a domain, you can use:

runas /user:DOMAIN\USERNAME cmd.exe

This can be run from the Run box ( Win+R ) or from a command window.

Note, however, that this is not exactly like sudo - you can't use it to elevate yourself, just run something as a different user. If you're already have administrative rights, a runas to your account will give you the same access as the regular command (unless, of course, you runas a different administrator account, which will grant those administrator's rights to the new shell)."
Guest [Entry]

"Another alternative is to click Start and type cmd, followed by Ctrl + Shift + Enter

Source: Microsoft Technet"
Guest [Entry]

"Create a batch file such as sudo.bat, and type the following commands and then save in the 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

To use it, for an instance, sudo cmd net start fms, however, the script won't work if there's quotemark in command line."
Guest [Entry]

"I was frustrated with the existing solutions for this, so I wrote a little Node.js script which should be more familiar to *nix users.

It elevates the current user with no password prompts (just UAC), redirects stdin and stdout, and runs in the same console window.

github.com/tehsenaus/windosu"
Guest [Entry]

The Open Command Prompt Shell Extension can add this capability for you as well.
Yerbrv [Entry]

atorvastatin 40mg canada <a href="https://lipiws.top/">brand atorvastatin 80mg</a> buy cheap lipitor