1

I have a batch file that creates another user using this code:

net user /add TheAccount passWORD
net localgroup administrators TheAccount /add

And I did this so that my program would later run commands elevated without the UAC popping up, because it could use its own account...

But I hit a roadblock when I noticed that RunAs doesn't allow elevation.

I really need to be able to run a program elevated without any third-party tools that I would have to include.

Thanks in advance.

cascading-style
  • 488
  • 9
  • 23
  • Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/129136/discussion-on-question-by-cascading-style-how-to-run-batch-file-as-an-elevated-u). – Bhargav Rao Nov 27 '16 at 10:27
  • Does this answer your question? [How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?](https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator) – Aconcagua Jan 10 '23 at 09:52

1 Answers1

0

Thanks for all the help, but I found an answer with Microsoft Psexec.exe with the -h option or the
-s option.

Community
  • 1
  • 1
cascading-style
  • 488
  • 9
  • 23