如何从命令提示符中找出PC的主机名
If you’re doing any work with networking, you probably need to know the name of your computer. Rather than diving into Control Panel, there’s a really simple way to do this from the command prompt.
如果您正在使用网络进行任何工作,则可能需要知道计算机的名称。 除了深入研究控制面板,还有一种非常简单的方法可以从命令提示符处执行此操作。
Note: If you haven’t already, be sure to read our complete guide to networking Windows 7 with XP and Vista.
注意:如果尚未安装,请务必阅读 完整的Windows 7与XP和Vista联网指南 。
To see the hostname… all you have to do is type hostname at the command prompt. Go figure, eh?
要查看主机名…,您要做的就是在命令提示符下键入主机名 。 去吧,是吗?
The same thing works in Linux or OS X, though you can see that most of the time the hostname is part of the prompt anyway. Note: you can also change the hostname by simply typing “hostname <newhostname>”.
同样的事情在Linux或OS X中也可以使用,尽管您可以看到大多数情况下主机名始终是提示的一部分。 注意:您也可以通过简单地键入“ hostname <newhostname>”来更改主机名。
Of course, the easiest way to see your computer name in Windows is to just hit the Win+Break key combination, which will pop up the System pane from Control Panel.
当然,在Windows中查看您的计算机名称的最简单方法是单击Win + Break组合键,这将从控制面板中弹出“系统”窗格。
If you want to change it instead, you can always change your computer name easily through Control Panel.
如果要更改它,则始终可以通过“控制面板”轻松地更改计算机名称 。
翻译自: https://www.howtogeek.com/howto/15821/how-to-figure-out-your-pcs-host-name-from-the-command-prompt/