第1个回答 2010-03-23
Process.Start("cmd.exe","/c net user bb bbb /add "); //新增用户名为bb密码为bbb的用户
Process.Start("cmd.exe","/c net localgroup administrators bb /add "); //将用户bb加入管理员组
Process.Start("cmd.exe","/c net user aa /del "); //删掉aa用户
先增加你想要的再删掉你不想要的账号,达到修改的目的
第2个回答 2010-03-23
声明:
//api SetComputerNameEx
//iType说明:
//typedef enum _COMPUTER_NAME_FORMAT
// {
// ComputerNameNetBIOS,
// ComputerNameDnsHostname,
// ComputerNameDnsDomain,
// ComputerNameDnsFullyQualified,
// ComputerNamePhysicalNetBIOS,
// ComputerNamePhysicalDnsHostname,
// ComputerNamePhysicalDnsDomain,
// ComputerNamePhysicalDnsFullyQualified,
// ComputerNameMax
// } COMPUTER_NAME_FORMAT ;
//
//lpComputerName说明: 计算机名称
[DllImport(“kernel32.dll“,EntryPoint=“SetComputerNameEx“)] public static extern int apiSetComputerNameEx(int iType,string lpComputerName);
设定计算机名称:
// set computer Name
int i = apiSetComputerNameEx(5,”RobertTest!”);
if (i == 0)
{
MessageBox.Show(“Modify Computer Name failed,Please try again!“);
}
else
{
MessageBox.Show(“Computer Name is Modified, Please Restart Computer Now!“);
}本回答被提问者采纳