//获取机器名 string machineName = Environment.MachineName; //获取用户名 string userName = Environment.UserName;