Elevate cmd to admin with command prompt?

101,806

You can't change the permission from a current CMD.exe. You have to restart it. This is a Windows limitation. I use NirCmd with the elevate switch to start tools elevated.

Share:
101,806

Related videos on Youtube

Spring Page
Author by

Spring Page

Updated on September 18, 2022

Comments

  • Spring Page
    Spring Page over 1 year

    Is there anyway to enable administrator access instead of having to right click command prompt and run as administrator?

    I tried runas /user:administrator CMD (prompts for password) net user administrator /active:yes (System error 5 has occurred. Access is denied.) runas /user:administrator luaexec.exe -w -f cmd.exe /k

    This is on my local machine running windows 8 and have no passwords on any accounts

    • Admin
      Admin about 10 years
      Wait... Do you want to elevate the current cmd or open a new, elevated one?
    • Admin
      Admin about 10 years
      I think there is a local security policy/directive that doesn't allow administrator logins nor executions for account with no passwords. Maybe that is your problem? Saddly, I don't know what directive that is, I suppose it should be at secpol.msc. If you find it, please, report.
    • Admin
      Admin about 10 years
      Is this method valid for you? superuser.com/questions/728810/…
    • Admin
      Admin about 10 years
      I have used this other method, too, but it is shell programming. You could make a .cmd to call it with your desired parameters, if any: stackoverflow.com/questions/5944180/…
    • Admin
      Admin about 10 years
      @Plasma - within the current cmd
    • Admin
      Admin about 10 years
      @nhat That is not possible, see this superuser question.
    • Admin
      Admin almost 7 years
    • Admin
      Admin over 4 years
  • Spring Page
    Spring Page about 10 years
    Unfortunately I'm trying to run a script to update IP addresses and what's preventing the command from executing is the cmd.exe needs to be in admin. It would be time consuming to go to every computer to do this.
  • Suncatcher
    Suncatcher over 6 years
    How to run this from usual (non-admin) CMD? Is it possible?
  • mdcoder85
    mdcoder85 almost 3 years
    No it is not possible. psexec installs temporary service with -h and it requires admin privileges to do that... It is chick and egg problem. Just use Ctrl + Shift + Enter from Windows search results.