I am using this code to take ownership of "C:\Program Files (x86)\Windows Sidebar\sidebar.exe" this file but it does not work
I am running this code as Run as Administrator. while i go through command prompt
and write the command like:
takeown /f "C:\Program Files (x86)\Windows Sidebar\sidebar.exe"
It works. but when i am using this in c# code it does not work. below is the tha code that i am using.it gives Error
"Invalid argument/options -Files".
please help me by giving some idea . how to resolve it.
private void button1_Click(object sender, EventArgs e)
{
String FileName = @"C:\Program Files (x86)\Windows Sidebar\sidebar.exe";
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = @" /k takeown /f " + FileName ;
process.StartInfo = startInfo;
process.Start();
}