1

When launching a program as an Administrator from Windows Explorer, I can right click on it and choose "Run as Administrator" and it just works.

However, from everything I've seen so far, to be able to run a program from C# (System.Diagnostics.Process) or cmd, you need to specify a password for the "administrator" account.

So, my question is, how can run a program programmatically just as "Run as Administrator" does (with no password prompt)?

Update

I have a program that's being run as an administrator using "Run as Administrator" context menu option. In this program, I run a batch script using System.Diagnostics.Process, but this batch script doesn't seem to run with administrator privileges.

So, how do I make the batch script I'm programmatically executing using System.Diagnostics.Process run with administrator privileges?

Thank you in advance.

Gezim
  • 7,112
  • 10
  • 62
  • 98

1 Answers1

-1

You can either:

  1. turn off UAC. check link on how to: http://windows.microsoft.com/en-US/windows-vista/Turn-User-Account-Control-on-or-off that way you dont have to run as administrator any more.

  2. right click on cmd and run as administrator.

  3. check this link on how to execute process as administrator: How to start a Process as administrator mode in C#

Community
  • 1
  • 1
malkassem
  • 1,937
  • 1
  • 20
  • 39