Solved

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

Posted on 2016-09-27
8
52 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
  • 4
  • 3
8 Comments
 
LVL 5

Accepted Solution

by:
D Patel earned 500 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 5

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 9

Expert Comment

by:Muhammad Mulla
ID: 41817588
Which OS are you using?
0
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 5

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now