>public bool SetAcl() >{ > if (this.Pathname == null || this.Pathname == "") > { > ErrorMessage += "Path cannot be empty."; > return false; > } > > // *** Strip off trailing backslash which isn't supported > if (this.Pathname.EndsWith("\\")) > this.Pathname = this.Pathname.Substring(0, this.Pathname.Length - 1); > > string CommandLine = '"' + System.IO.Path.GetFullPath(this.Pathname) + '"' + " /C "; > > if (this.InheritSubDirectories) > CommandLine += @" /T "; > if (!this.OverrideExistingRights) > CommandLine += @" /E "; > > CommandLine += @" /P " + this.Username + ":" + this.UserRights; > > //System.Windows.Forms.Clipboard.SetDataObject( CommandLine ); > > Process p = new Process(); > p.StartInfo.FileName = "cacls.exe"; > p.StartInfo.Arguments = CommandLine; > p.StartInfo.RedirectStandardOutput = true; > p.StartInfo.RedirectStandardInput = true; > p.StartInfo.UseShellExecute = false; > p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; > p.StartInfo.CreateNoWindow = true; > > > p.Start(); > > p.StandardInput.Write("Y\r\n"); > string Response = p.StandardOutput.ReadToEnd(); > > // *** If no output gets generated there's an error > if (Response == null || Response == "") > { > this.ErrorMessage += "Unable to set permissions on " + this.Pathname + " for " + this.Username; > return false; > } > > //System.Windows.Forms.MessageBox.Show( Response); > > return true; >} >>