Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW to create an elevated command Prompt in Vista? 4

Status
Not open for further replies.

cgkeller

Programmer
Apr 12, 2000
200
CA
I'm trying to get an elevated command prompt on my computer and I don't know how to do it. Could you please help me
 
Click Start
Start Search
type CMD look on the list for cmd.exe
Right Click it select run as administrator
select continue if UAC asks
 
start-search-type cmd press ctrl-shift-enter thats it.



xit
 
This is interesting. What about if you want to do the same, but in a batch file. Is it possible? For instance, in Linux, you can do sudo..... Is there a command in XP, Vista, and/or 7 that does the same but on Windows?

I don't know that I'll NEED it, but I recently created a short batch file for a simple command for somebody, b/c I didn't want to go through trying to tell them....
click here... no, not there.... oh, no, not right-click,... left click.... okay.. let's start again...."

Yeah, I've been there a few times... over the phone... when I didn't really want to be on the phone...
 
You can use the runas (Run As) command from the command prompt to execute anything with any specific privileges provided you have the user and password you want to use.

Code:
runas user:myuser executable.exe

When run it ill ask for the provided user's password.

For more help type runas /? at the prompt.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Here's a batch file we use for staring an Elevated command-prompt as another user. Since our regular user accounts are separate from our Administrator accounts (best practice) it's a pain to get Vista to do a "run as another user" on a command-prompt AND do it as an administrator.


Create a short-cut to this batch file and then right-click on it and do "run as Administrator."
Code:
@echo off
runas /savecred /u:DOMAIN HERE\USERNAME HERE "cmd.exe /K title %USERNAME%"

Additionally, here's how to run any random program as someone else. Just drag the program icon you want to run onto this batch file:
Code:
@echo off
runas /u:DOMAIN\USERNAME %1


 
Thanks for the additional info, hgate73.

When you run these, does it prompt you for the login password, or else where do you add it in the batch file?
 
It will prompt for the login password, unfortunately. If you want to embed your password IN the batch file (bad practice!!) you could use CPAU.exe. You'll have to google it, but it lets you run things as another user and save the password in the script.
 
Yeah. I understand the bad practice part. For now it's just a thought. Don't know if I'll ever actually use it or not.
 
I'm using Win 7 but same thing applies - I found a Power Toy that will do this for you. Now I can just click Start > Run > elevate cmd and it'll eleavate it for me

I can't seem to find it now but the below link might be it ... not 100% sure though


Irish Poetry - Karen O'Connor
Irish Poetry and Short Stories - Doghouse Books
Garten und Landschaftsbau
 
Sounds interesting, gmail2. If you do find the specific link, please share.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top