简体   繁体   中英

Program running in administrative mode needs to run another application in non-administrative mode?

I have a program that runs in administrative mode. This program should run another application. Since my application is run in administrative mode, the new application is run in administrative too. How to run this new application in non-administrative mode?

What you want is Process.Start passing a StartInfo object specifies the credentials of the use you want to start the process as.

Process.Start Method (ProcessStartInfo)

Something like this should get you started . . .

var startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.FileName = "Myexe.exe";
startInfo.UserName = "Myuser";
startInfo.Password = "MyUsersPassword";
System.Diagnostics.Process.Start(startInfo);

If you want it to run as the current user, but not in admin mode, try passing the current users credentials, I haven't tested it, but it might work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM