hi,
i am using cacls command to grant full permission to the user.But it's not working i am posting here source code please help me to identify the error.I also try this code by using Administrator account but it's not changing the file permission.
code is
ProcessStartInfo psiOpt = new ProcessStartInfo(@"cacls.exe", @"""" + strDir + @""" /E /G """+Environment.UserName+@""":F");//i also tried here by giving user name manually
// We don't want to show the Command Prompt window and we want the output redirected
psiOpt.WindowStyle = ProcessWindowStyle.Hidden;
psiOpt.RedirectStandardOutput = true;
psiOpt.UseShellExecute = false;
psiOpt.CreateNoWindow = true;
// Create the actual process object
Process procCommand = Process.Start(psiOpt);
// Receives the output of the Command Prompt
// StreamReader srIncoming = procCommand.StandardOutput;
// Show the result
// Console.WriteLine(srIncoming.ReadToEnd());
// Close the process
procCommand.WaitForExit();