简体   繁体   中英

execute run as command and enter password in c#

I am trying to execute

runas /netonly /user:domain\\username "C:\\Users\\user\\Documents\\Visual Studio 2015\\Projects\\samplePACE\\samplePACE\\bin\\Debug\\samplePACE.exe brown"

samplePACE.exe is the Application name and brown is the argument.

It will ask for a password. I have to enter and then the application gets executed.

I need to perform the above two operations using C#.

Thanks.

You want to use use the Process class to run the process. Scroll to the bottom of that page for an example on how it is used.

To elevate (aka run as Administrator), you will need to use the 'runas' verb. See this SO post for more info: Elevating process privilege programmatically?

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