我想通过c#中的代码更改主机名。 操作系统是xp。
谢谢。
最佳答案
ManagementClass mComputerSystem = new ManagementClass("Win32_ComputerSystem");
ManagementBaseObject outParams;
ManagementBaseObject objNewComputerName = mComputerSystem.GetMethodParameters("Rename");
objNewComputerName["Name"] = "NEWNAMEHERE";
outParams = mComputerSystem.InvokeMethod("Rename", objNewComputerName, null);
关于c# - 如何在 C# 中更改主机名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1404063/