C#给系统添加账户

 

net user aa aa /add /fullname:"Name" /comment:"Text"
        

指定用户的全名而不是用户名。给该名称加上引号。

/comment:"Text"
提供关于用户帐户的描述性注释。该注释可以包含多达 48 个字符。给文本加上引号。

/fullname:"Name"
        
指定用户的全名而不是用户名。给该名称加上引号。

添加用户和删除用户的命令相信大家都知道,这就不例出了!

 

代码示例: 

 

using System.Diagnostics;

Process p = new Process();

        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.UseShellExecute = false;

        p.StartInfo.FileName = "cmd.exe";

//描述
        string comment = @"""启动 Application Center Test 辅助服务的帐户""";

        p.StartInfo.Arguments = "/c net user ACTDebugger ACTDebugger /add /comment:" + comment;
        p.Start(); p.Dispose();

        p = new Process();
        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.FileName = "cmd.exe";
        p.StartInfo.Arguments = "/c net localgroup Administrators ACTDebugger /add";
        p.Start(); p.Dispose();
posted on 2008-10-27 15:37  冷月孤峰  阅读(327)  评论(0)    收藏  举报