Getting System Information


The attached source code returns the system information for your machine such as machine name, operating system, current user and logical drives.

//Gives the Directory which is using by ur system
lbl13.Text=Environment.CurrentDirectory;
//Shows u the system Directory
lbl12.Text=Environment.SystemDirectory;
//show the version of the system
lbl11.Text=Convert.ToString(Environment.Version);
lbl10.Text=Convert.ToString(Environment.OSVersion);
//Shows the Machine Name
lbl9.Text=Environment.MachineName;
lbl8.Text=Convert.ToString(Environment.WorkingSet);
//Command Line Arguments
string [] args=Environment.GetCommandLineArgs();
for (int x=0;x<args.Length;x++)
{
MessageBox.Show(args[x],"Command Line Arguments",MessageBoxButtons.OK,
MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1,MessageBoxOptions
.ServiceNotification);
}
//Logical Drives
string []drives=Environment.GetLogicalDrives();
for(int x=0;x<drives.Length;x++)
{
MessageBox.Show(drives[x],"LogicalDrives",MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
// Display the Current User Name
MessageBox.Show(Environment.UserName,"Current User Name",MessageBoxButtons.OK,MessageBoxIcon.Information);
lbl16.Text=Environment.StackTrace;
//Shows the Domain name of the system
lbl18.Text=Environment.UserDomainName;

Up Next
    Ebook Download
    View all
    Learn
    View all