C# 基础

1. 程序根目录:
(D:\...\WpfApp1\WpfApp1\bin\Debug")
string exePath = Environment.CurrentDirectory;

2. 获取该进程的命令行
("D:\...\WpfApp1\WpfApp1\bin\Debug\WpfApp1.exe" )
string commandLine = Environment.CommandLine;

3. CPU 核数
int cpuCount = Environment.ProcessorCount;

4. 系统目录
(C:\WINDOWS\system32)
string systemPath = Environment.SystemDirectory;

5. 计算机启动到现在的毫秒数
int tickCount = Environment.TickCount;
原文地址:https://www.cnblogs.com/MichaelLoveSna/p/14474488.html