For anyone playing around with a Console App
or the System.Environment Class ...
here's a teaser.
using System;
using System.Collections.Generic;
using System.Text;
// codehimbelonga kwb : posted@TheSwamp 20060213
// For NET 2.0 Console App
namespace ConsoleApplication20060213A
{
class Program
{
static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue;
Console.WindowWidth = 120;
Console.Clear();
try {
DateTime dt = DateTime.Now;
// http://msdn2.microsoft.com/en-us/library/zdtaw1bw.aspx
Console.Title = (string.Format(" Console Application Testing : KDUB {0} ",
dt.ToString("yyyy, MMM, dd HH:mm:ss")));
Console.WriteLine("Current Operating System : {0} ", Environment.OSVersion);
Console.WriteLine("Current User Name : {0} ", Environment.UserName);
Console.WriteLine(Environment.NewLine);
Console.WriteLine("NET Version : {0} ", Environment.Version);
Console.WriteLine(Environment.NewLine);
Console.ForegroundColor = ConsoleColor.Black;
Console.WriteLine("Current Directory : {0} ", Environment.CurrentDirectory);
Console.WriteLine(Environment.NewLine);
Console.ForegroundColor = ConsoleColor.White;
string[] drives = Environment.GetLogicalDrives();
for (int i = 0; i < drives.Length; i++)
Console.WriteLine("Drive {0} : {1} ", i, drives[i]);
Console.WriteLine(Environment.NewLine);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("Personal Folder : {0} ",
Environment.GetFolderPath(Environment.SpecialFolder.Personal));
Console.WriteLine("My Documents Folder : {0} ",
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
Console.WriteLine("ProgramFiles Folder : {0} ",
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
Console.WriteLine("LocalApplicationData Folder : {0} ",
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
Console.WriteLine("Favorites Folder : {0} ",
Environment.GetFolderPath(Environment.SpecialFolder.Favorites));
Console.WriteLine("Internet Cache : {0} ",
Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
Console.WriteLine(Environment.NewLine);
} catch (Exception e) { Console.WriteLine(e.ToString()); }
}
}
}