C# 基础 - Environment 类

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;
posted @ 2021-03-03 19:21  鑫茂  阅读(506)  评论(0编辑  收藏  举报