软件使用微软系统的唯一ID绑定指定电脑

 class Program
    {
        static void Main(string[] args)
        {
            string sysId = "";
            Process da = new Process();
            da.StartInfo.FileName = "cmd.exe";
            da.StartInfo.Arguments = "/k cscript %WINDIR%\\SYSTEM32\\SLMGR.VBS /DTI";
            da.StartInfo.UseShellExecute = false;       //是否使用操作系统shell启动
            da.StartInfo.RedirectStandardInput = true;  //接受来自调用程序的输入信息
            da.StartInfo.RedirectStandardOutput = true; //由调用程序获取输出信息
            da.StartInfo.RedirectStandardError = true;  //重定向标准错误输出
            da.StartInfo.CreateNoWindow = true;         //不显示程序窗口
            da.Start();                                 //启动程序
            da.StandardInput.WriteLine("exit");
            string strRst = da.StandardOutput.ReadToEnd();
            string[] readLine = strRst.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            string id = readLine[2].Split(':')[1].Trim();
            sysId = id;
            Console.WriteLine(sysId);
            Console.ReadKey();
        }
    }

获取电脑系统唯一GUID

 

相关文章:

  • 2021-05-25
  • 2022-02-13
  • 2021-09-15
  • 2022-03-08
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
猜你喜欢
  • 2022-12-23
  • 2021-09-27
  • 2021-11-30
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案