如何解决在Windows 10 C# 1.更改 Windows 10/专业桌面的名称:2.更改 Mac 电脑的名称:3.在 Windows 8 中更改您的计算机名称:
我发现命令
Rename-Computer -NewName "NewName"
在Powershell中运行可以正常工作。但是,当我这样从C#代码运行它时:
PowerShell ps = PowerShell.Create();
ps.AddCommand("Rename-Computer").AddParameter("NewName",PcName);
ps.Invoke();
它什么都不做。我还更改了Powershell执行策略,但它没有影响结果。 在StackOverflow上发布的以前的解决方案不起作用-似乎它们已经陈旧和/或不再适用于Windows 10。
解决方案:看来问题出在Windows更新挂起(重新启动和更新)。当我完成Windows更新时,该代码实际上起作用了。
解决方法
更改计算机名称:
1.更改 Windows 10/专业桌面的名称:
i.) 您可以通过以下设置更改 Windows 10 或专业版中的桌面名称或笔记本电脑名称:
Open the quick menu by right-clicking on the Windows symbol or using the shortcut combination [Windows] key + [X].
Click on “Settings”.
In the dialog window,select “System”.
In the left menu bar,select “About”.
Click on the “Rename PC” field.
现在,您可以重命名计算机并根据需要重新启动它。
ii.) 通过命令提示符 (cmd)
In the Start menu,or using the shortcut combination [Windows] key + [R],open the “Run” dialog window.
Enter the command “sysdm.cpl” and then confirm by clicking on “OK”.
Click on the “Change” button to confirm.
Now,you can change your workgroup or the name of your computer in the window that’s open.
iii.) 通过组合键:
Press down the key combinations [Windows] key + [Pause] key.
Under “Computer name,domain and workgroup settings” select the option “Change settings”.
In the window that opens,under “Computer Name”,select the “Change…” button to continue.
You can now change the workgroup or the name of your PC.
2.更改 Mac 电脑的名称:
Click on the Apple symbol in the top left corner,and select the option “System Preferences” from the drop-down menu.
Open the “Sharing” box by clicking on it.
The current name of your device will appear beside “Computer Name”.
Change your computer name to your liking and close the window.
3.在 Windows 8 中更改您的计算机名称:
在 Windows 8 中更改计算机名称同样容易,并且有多种方法可以这样做。如前所述:完成任务需要管理员权限。
i.) 通过高级系统设置:
Hover the mouse pointer above the lower,upper,or left corner of the screen to open the “Charms Bar”.
Click on “Settings” and then on “PC settings”.
In the window that opens,select “Computer name” from the “Advanced settings” section.
Click on “Change” to open a new window where you can change the name of your PC.
ii.) 通过命令提示符 (cmd) sysdm.cpl :
Use the shortcut [Windows] key + [R] to open up the Run dialog.
Enter the command “sysdm.cpl” and then press on Enter.
In the dialog window “System properties” select the “Change” button to continue.
In the window that opens,you now have the option to change your workgroup or to rename your computer.
,
为此,要运行它并查看名称已更改,您需要以管理员权限运行应用程序。
此外,重新启动计算机后,名称将发生更改。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。