using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO; namespace T
{
class GetCpuid
{
public string Getid()
{
try
{
string Str = InvokeCmd("@wmic cpu get processorId > c:\\tmpp.txt");
StreamReader sr = new StreamReader(@"c:\tmpp.txt", Encoding.Default);
string s, Id = "null";
int mk = 0;
while ((s = sr.ReadLine()) != null)
{
mk++;
if (mk == 2) Id = s;
}
sr.Close();
InvokeCmd("del c:\\tmpp.txt");
Id = Id.Trim();
return Id;
}
catch
{
return "null";
} } private string InvokeCmd(string cmdArgs)
{
string Tstr = "";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start(); p.StandardInput.WriteLine(cmdArgs);
p.StandardInput.WriteLine("exit");
Tstr = p.StandardOutput.ReadToEnd();
p.Close();
return Tstr;
}
}
}

C#-获取CPUID的更多相关文章

  1. java支持跨平台获取cpuid、主板id、硬盘id、mac地址 (兼容windows、Linux)

    windows: package cn.net.comsys.helper.system.info;   import java.io.BufferedReader; import java.io.F ...

  2. 获取CPUID等

    unit CommonUnit; interface uses Windows, SysUtils, DateUtils; Const CPUVendorIDs: .. ] of string = ( ...

  3. C#获取CPUID(MD5输出),网卡ID,主DNS,备用DNS

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  4. 获取硬件信息的delphi源码CPUID、操作系统、Mac物理地址、计算机名称、IP地址、用户名

    {-----------------------------------------------------------------------------作者:sushengmiyan 2013.0 ...

  5. C# 获取计算机信息

    //C#获取当前计算机的系统信息 //系统标识符和版本号 string strSystem = Environment.OSVersion.ToString(); //获取映射到进程上下文的物理内存量 ...

  6. WMI 获取硬件信息的封装函数与获取联想台式机的出厂编号方法

    原文:WMI 获取硬件信息的封装函数与获取联想台式机的出厂编号方法 今天玩了一把WMI,查询了一下电脑的硬件信息,感觉很多代码都是可以提取出来的,就自己把那些公共部分提出出来,以后如果要获取 某部分的 ...

  7. 本地服务器硬件信息获取指令wmic

    获取BIOS序列号 wmic bios list full | find "SerialNumber" SerialNumber=P50168VB 获取CPUID(WIN32_PR ...

  8. 获取本地机器的特征码IP MAC

    using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Ma ...

  9. c#中如何获取本机MAC地址、IP地址、硬盘ID、CPU序列号等系统信息

    我们在利用C#开发桌面程序(Winform)程序的时候,经常需要获取一些跟系统相关的信息,例如用户名.MAC地址.IP地址.硬盘ID.CPU序列号.系统名称.物理内存等. 首先需要引入命名空间: us ...

随机推荐

  1. js 数组的浅拷贝和深拷贝

    1.背景介绍 javascript分原始类型与引用类型.Array是引用类型,直接用"="号赋值的话,只是把源数组的地址(或叫指针)赋值给目的数组,指向的是同一个内存地址,其中一个 ...

  2. 2019 GDUT Rating Contest III : Problem A. Out of Sorts

    题面: 传送门 A. Out of Sorts Input file: standard input Output file: standard output Time limit: 1 second M ...

  3. jQuery学习笔记(2) jQuery选择器

     jQuery的选择器完全继承了CSS的风格,利用jQuery选择器,可以非常便捷和快速地找出特定的DOM元素,然后为它们添加相应的行为. 目录 目录 CSS选择器 jQuery选择器 jQuery选 ...

  4. 你真的懂 i++ 和 ++i 吗?

    对于 ++i 和 i++,许多人可能都知道,不就是先加1再取值,和先取值再加1嘛.然而,真的是这样吗?请先看以下4道题,能全部答对可以忽略这篇文章. 题目 // 示例1 int i = 1; i = ...

  5. 快速了解C# 8.0中“可空引用类型(Nullable reference type)”语言特性

    Visual C# 8.0中引入了可空引用类型(Nullable reference type),通过编译器提供的强大功能,帮助开发人员尽可能地规避由空引用带来的代码问题.这里我大致介绍一下可空引用类 ...

  6. 基金 A 类和 C 类、ETF、LOF、QDII 到底是啥?

    ETF 对于初入股市的新手来说,买了一只公司股票容易,想买一个行业的股票就不是很容易了. 比如你要懂得行业里都有谁,每个公司分配多少钱,最主要股票交易最少要交易 1 手也就是 100 股,要是想配置一 ...

  7. elf.h

    1 /* This file defines standard ELF types, structures, and macros. 2 Copyright (C) 1995-2019 Free So ...

  8. 在SSM框架中如何将图片上传到数据库中

    今天我们来看看SSM中如何将图片转换成二进制,最后传入到自己的数据库中,好了,废话不多说,我们开始今天的学习,我这里用的编辑器是IDEA 1.导入图片上传需要的jar依赖包 1 <depende ...

  9. TypeError: 'list' object cannot be interpreted as an integer Python常见错误

    想要通过索引来迭代一个list或者string的元素, 这需要调用 range() 函数.要记得返回len 值而不是返回这个列表.

  10. PictureCleaner 官方版 v1.1.3.04061,免费的图片校正及漂白专业工具,专业去除文档图片黑底麻点杂色,规格化A4、B5尺寸输出,还你一个清晰的文本。

    当家长多年,每天都要拍照试卷打印.用App去掉图片黑底就成了每天必备工作.可是,有些图片文件不是来自手机,所以需要一个电脑版的图片漂白工具.经过一个多月努力,PictureCleaner官方版诞生了 ...