Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I elevate a open cmd window such that it has administrator rights as it would have if i would start it with "run as administrator"?

share|improve this question
add comment

2 Answers

You can use the runas command to elevate individual commands, and you can use runas to start a new shell, but you cannot elevate the current shell.

share|improve this answer
    
hmmm - can I use this somehow together with "reg" to make changes to the registry from an unelevated cmd promt? the problem is, that at the moment i can't start elevated apps because i messed something up in the registry, but i need an elevated cmd to make use of "reg", and also regedit requires to be run elevated –  Mat Mar 9 '12 at 12:45
3  
You should specify that in your question! Entirely different solution! But that said, you can try using it to elevate reg. If your problem is that you're not receiving any elevation prompts, it won't work. You'll instead need to use a Win7 install or Startup Repair disc to load and edit what you need to edit. –  EKW Mar 9 '12 at 12:53
    
I think using RunAs will start a new process with elevated privileges, not elevate the current process. But I'm with EKW, you need to boot to a repair disk to fix this. –  uSlackr Mar 9 '12 at 13:13
    
@uSlackr You're correct, runas will open a new process. But, in some cases, elevation from Explorer can be broken without affecting elevation from a command prompt. Similar issues can show up with InstallShield. –  EKW Mar 9 '12 at 13:15
    
It wil be interesting to see the fix for this. I've never heard of it before. –  uSlackr Mar 9 '12 at 13:35
show 2 more comments

I have a hard time believing that this would be possible. Even the example by Microsoft restarts the process to achieve elevation.

share|improve this answer
    
This is correct. A process can only be elevated at startup. –  surfasb Mar 10 '12 at 2:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.