When I'm currently in a command line window and I change an environmental variable I have to reopen a cmd.exe instance. When I want to install a python package using pip from the command line I have to run it in administrator mode as well.

I was wondering if there is a command / shortcut to reopen a cmd.exe instance in administrator mode.

I know I can use start cmd.exe to open a new command line instance and I've seen that apparently you can use runas to run a service from the command line in administrator mode, but this prompted me for my administrator password which does not correspond to my user password apparently.

  • 2
    If the user you are logged into, is not an Administrator, you will have to input an elevated user's permissions in order to do what you want. – Ramhound Aug 7 '18 at 14:22

If you already started cmd as administrator then you can simply create another (child) copy of administrative console that will inherit parent's environment without providing admin's password by simply running:


so in your case set environment variables you need in parent administrative console, then run start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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