Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


how to run a program as adminitrator via the command line?

Posted on 2016-09-27
Medium Priority
Last Modified: 2016-09-28
My account name is ''user1'' and i don't have administartors rights
The 2'nd acc. called: ''admin1'' is the administrator
My question is:How can i run a Program.exe from my acc. using cmd.exe as administrator(using admin1 rights)

i tried this,i sucessfully connect as admin1, but when i try to run the tool.exe says:Acces Denied
runas /user:admin1 cmd.exe 

Open in new window

Question by:john lambert
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Accepted Solution

D Patel earned 2000 total points
ID: 41817573
Create a new txtfile, pase this content:

@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
and save it as SUDO.cmd.
Now copy the cmd to your system32 folder.

When you now want to run a programm with admin rights type this:

sudo cmd /k javaw.exe JAVA file
Now accept the UAC prompt.

Hope this helps.

Expert Comment

by:D Patel
ID: 41817577
runas /profile /user:administrator “Driver:\folder\program”

For example, the administrator account is “AAA” and you want to run BBB.exe of C:\programs, you should do these following steps:

1 Press Win key & R

2 Input “CMD” in open box and click “OK”

3 Input: runas /profile /user:AAA “C:\programs\BBB.exe”  and press “Enter”

4 Input the password of administrator AAA

5 Press “Enter”

Hope it works.
LVL 10

Expert Comment

by:Muhammad Mulla
ID: 41817588
Which OS are you using?
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Comment

by:john lambert
ID: 41817603
i'm using 2 rdp's one of them server2008 rc2 and a windows7 so first i tried ''D Patel'' method:
I receive this message: this operation needs administartor rights

This not working
runas /profile /user:admin1 ”C:\folder\optimizer.exe”

This open my tools but when i run it,still asking for admins rights
runas /profile /user:admin1 C:\folder\optimizer.exe

Author Comment

by:john lambert
ID: 41817612
this method seems to work but if UAC is disabled?is possible that ?

works fine:

@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
and save it as SUDO.cmd.
Now copy the cmd to your system32 folder.

Open in new window


Expert Comment

by:D Patel
ID: 41817663
Does UAC is already disabled or you did it?

If you did it then you will have to restart your PC first and then check the result.

Author Comment

by:john lambert
ID: 41817908
UAC worked well...but in case UAC is disabled,uhh will be more dificult

Author Closing Comment

by:john lambert
ID: 41819340
thank you...problem solved!!!!

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question