devxlogo

Retrieving PC or System Information

Retrieving PC or System Information

To retrieve PC or System information (things like the operating system, domain name, logical drives, IP address, or environment variables), use the System class and the Environment class. List of name space used in the project

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Net;using Microsoft.Win32;using System.Collections;private void Form1_Load(object sender, EventArgs e){// There are about 5 labels  in the formlabel1.Text = Environment.SystemDirectory;label2.Text = Environment.MachineName;label3.Text = Environment.CurrentDirectory;label5.Text = Environment.OSVersion.ToString();IDictionary environmentVariables = Environment.GetEnvironmentVariables();string str2 = "";string str3 = "";foreach (DictionaryEntry de in environmentVariables){ str2 = de.Key.ToString();str3 = str3 + str2 + " , ";} label5.Text = str3; }
See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist