System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd";
p.StartInfo.Arguments = " /c net share " + shareName + "=" + "\"" + folderName +"\"";
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.WaitForExit();