?
Solved

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

Posted on 2016-09-27
8
Medium Priority
?
90 Views
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

0
Comment
Question by:john lambert
[X]
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
8 Comments
 
LVL 7

Accepted Solution

by:
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.
1
 
LVL 7

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.
0
 
LVL 10

Expert Comment

by:Muhammad Mulla
ID: 41817588
Which OS are you using?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
0
 

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

0
 
LVL 7

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.
1
 

Author Comment

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

Author Closing Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

764 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