A. This method is used to execute the command on the command prompt
 public static int ExecuteCommand(string commnd, int timeout)
 {
        var pp = new ProcessStartInfo("cmd.exe", "/C" + commnd)
        {
            CreateNoWindow = true,
            UseShellExecute = false,
            WorkingDirectory = "C:\\",
        };
        var process = Process.Start(pp);
        process.WaitForExit(timeout);
        process.Close();
        return 0;
  }
2. Call this method
ExecuteCommand("net use \\\\" + serverip + "\\" + sharedfolderpath + " " + password + " /user:" + username + "", 5000);