Reputation: 4359
If I run takeown /F "C:\Program Files\Borland /A /R /D Y
from an elevated command prompt, I'm given ownership of the Borland
folder. But if I run the code below nothing happens. Tried running as Administrator and regular user.
Process process = new Process();
process.StartInfo.FileName = @"C:\Windows\System32\takeown.exe";
process.StartInfo.Verb = "runas";
process.StartInfo.Arguments = "/F \"C:\\Program Files\\Borland\" /A /R /D Y";
process.Start();
process.WaitForExit();
What am I missing?
Upvotes: 4
Views: 660
Reputation: 146
Had the same issue. Release build(but not default "Debug") helps me.
Upvotes: 0
Reputation: 4359
A format and re-install of Windows seemed to do the trick. I wish I had a better answer but after much searching, I found nothing that worked. Perhaps an existing security setting was preventing it from working.
Upvotes: 0
Reputation: 13229
You need to have useshellexecute set to false on your startinfo object in order to be prompted by UAC
Upvotes: 3