C#修改用户名

string strCmdText;
            strCmdText = "useraccount where name='" + 旧密码 + "' rename " + 新密码;
            try
            {
                System.Diagnostics.Process.Start("wmic.exe", strCmdText);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("修改失败,原因:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
原文地址:https://www.cnblogs.com/xxxteam/p/3316533.html