获取计算机名称 [英] Get the computer name

查看:28
本文介绍了获取计算机名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取当前的计算机名称.

I want to get the current computer name.

这是我的代码:

Public Function GetComputerName() As String
    Dim ComputerName As String
    ComputerName = System.Net.Dns.GetHostName
    Return ComputerName
End Function

此代码有效,但我记得有更快的方法.

this code working, but i remember that there is faster way.

获取计算机名称的快速方法是什么?

what is the fast way to get the computer name?

推荐答案

你可以不用函数就直接使用:

you can just use without function:

System.Net.Dns.GetHostName

或:

Environment.MachineName

这篇关于获取计算机名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆