Environment.MachineName 속성

정의

이 로컬 컴퓨터의 NetBIOS 이름을 가져옵니다.Gets the NetBIOS name of this local computer.

public:
 static property System::String ^ MachineName { System::String ^ get(); };
public static string MachineName { get; }
member this.MachineName : string
Public Shared ReadOnly Property MachineName As String

속성 값

이 컴퓨터의 이름이 포함된 문자열입니다.A string containing the name of this computer.

예외

이 컴퓨터의 이름을 가져올 수 없습니다.The name of this computer cannot be obtained.

예제

다음 예제에서는 코드 예제를 실행 하는 컴퓨터의 이름을 표시 합니다.The following example displays the name of the computer that runs the code example. (컴퓨터 이름 보안상의 이유로 예제의 출력에서 생략 됩니다.)(The machine name is omitted from the example output for security reasons.)

// Sample for the Environment::MachineName property
using namespace System;
int main()
{
   Console::WriteLine();
   
   //  <-- Keep this information secure! -->
   Console::WriteLine( "MachineName: {0}", Environment::MachineName );
}

/*
This example produces the following results:
(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".)

MachineName: !---OMITTED---!
*/
// Sample for the Environment.MachineName property
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine();
//  <-- Keep this information secure! -->
    Console.WriteLine("MachineName: {0}", Environment.MachineName);
    }
}
/*
This example produces the following results:
(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked "!---OMITTED---!".)

MachineName: !---OMITTED---!
*/
' Sample for the Environment.MachineName property
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      '  <-- Keep this information secure! -->
      Console.WriteLine("MachineName: {0}", Environment.MachineName)
   End Sub
End Class
'
'This example produces the following results:
'(Any result that is lengthy, specific to the machine on which this sample was tested, 
'or reveals information that should remain secure, has been omitted 
'and marked "!---OMITTED---!".)
'
'MachineName: !---OMITTED---!
'

설명

이 컴퓨터의 이름의 이름을 레지스트리에서 읽을 때 시스템을 시작할 때 설정 됩니다.The name of this computer is established at system startup when the name is read from the registry. 이 컴퓨터는 클러스터의 노드인 경우 노드 이름을 반환 됩니다.If this computer is a node in a cluster, the name of the node is returned.

적용 대상