using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // 현재 작업 디렉터리의 정규화된 경로를 가져오거나 설정합니다. txtWindowCode.Text += "@ 디렉토리 경로 : " + Environment.CurrentDirectory + "\r\n"; // 프로세스의 종료 코드를 가져오거나 설정합니다. txtWindowCode.Text += "@ 프로세스종료코드 : " + Environment.ExitCode + "\r\n"; // 이 로컬 컴퓨터의 NetBIOS 이름을 가져옵니다. txtWindowCode.Text += "@ NetBIOS 이름 : " + Environment.MachineName + "\r\n"; // OSVersion txtWindowCode.Text += "@ OSVersion : " + Environment.OSVersion.ToString() + "\r\n"; // 시스템 디렉터리의 정규화된 경로를 가져옵니다. txtWindowCode.Text += "@ 시스템디렉토리 : " + Environment.SystemDirectory + "\r\n"; // 시스템 시작 이후 경과 시간(밀리초)을 가져옵니다. txtWindowCode.Text += "@ 시스템걸린시간 : " + Environment.TickCount + "\r\n"; // 현재 사용자와 관련된 네트워크 도메인 이름을 가져옵니다. txtWindowCode.Text += "@ 도메인이름 : " + Environment.UserDomainName + "\r\n"; // Windows 운영 체제에 현재 로그온한 사용자의 이름을 가져옵니다. txtWindowCode.Text += "@ 운영체제이름 : " + Environment.UserName + "\r\n"; // 공용 언어 런타임의 주 번호, 보조 번호, 빌드 번호 및 수정 번호를 // 설명하는 Version 개체를 가져옵니다. txtWindowCode.Text += "@ OS 버전 : " + Environment.Version.ToString() + "\r\n"; txtWindowCode.Text += "@ WorkingSet : " + Environment.WorkingSet + "\r\n"; OperatingSystem os = Environment.OSVersion; Version v = os.Version; if (5 == v.Major && v.Minor > 0) { txtWindowCode.Text += "@ OS버전 : " + "Windows XP" + "\r\n"; } else if (6 == v.Major && v.Minor == 0) { txtWindowCode.Text += "@ OS버전 : " + "Windows VISTA" + "\r\n"; } else if (6 == v.Major && v.Minor == 1) { txtWindowCode.Text += "@ OS버전 : " + "Windows 7 " + "\r\n"; } else { txtWindowCode.Text += "@ 그 외 OS" + "\r\n"; } txtWindowCode.Text += "@ 서비스팩버전 : " + os.ServicePack + "\r\n"; txtWindowCode.Text += "@ Build : " + v.Build + "\r\n"; txtWindowCode.Text += "@ Revision : " + v.Revision + "\r\n"; } } }
출처: https://mainia.tistory.com/1257 [녹두장군 – 상상을 현실로]