使用C#代码实现获取Windows系统环境变量

作者:佚名 上传时间:2023-04-30 运行软件:Microsoft Visual Studio Community 2019 软件版本:.NET Framework 4.7.2 版权申诉

本示例介绍如何使用C#代码获取Windows系统环境变量,可用于获取系统路径等信息。

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace GetWindowsEnvironmentVariables
{
    class Program
    {
        static void Main(string[] args)
        {
            IDictionary environmentVariables = Environment.GetEnvironmentVariables();

            foreach (DictionaryEntry de in environmentVariables)
            {
                Console.WriteLine("{0}={1}", de.Key, de.Value);
            }

            Console.ReadKey();
        }
    }
}

免责申明:文章和图片全部来源于公开网络,如有侵权,请通知删除 server@dude6.com

用户评论
相关推荐
使用C#代码实现获取Windows系统环境变量
本示例介绍如何使用C#代码获取Windows系统环境变量,可用于获取系统路径等信息。using System;using System.Collections;using System.Coll
.NET Framework 4.7.2
Microsoft Visual Studio Community 2019
2023-04-30 14:08
使用C#获取WINDOWS系统的图标
使用C#获取WINDOWS系统的图标--DEMO
CS
0B
2019-07-05 03:40
c# 的winform获取系统环境变量
获取大部分系统中环境变量,包括管理员、当前用户名、系统路径、操作系统参数、处理器参数等
RAR
0B
2018-12-28 04:21
获取Windows环境变量Delphi源码..rar
获取Windows环境变量,Delphi源码..rar
RAR
0B
2019-05-21 17:04
获取系统环境变量.rar
获取系统环境变量.rar获取系统环境变量.rar获取系统环境变量.rar
RAR
0B
2019-05-21 17:04
VB获取系统环境变量
使用vb将系统环境变量全部读出并可以显示出来
RAR
0B
2020-05-15 08:17
C#获取Windows系统服务信息
C#获取Windows系统服务信息
ZIP
0B
2019-05-28 14:50
C# 系统应用之获取Windows最近使用记录
由于毕业设计项目需要删除Windows最近历史记录,这就需要获取Windows最近历史记录 Recent.本文就主要叙述通过C#实现获取Recent中使用的文件
使用Python代码快速实现Windows系统操作
这篇文章将教你如何使用Python编写简单的代码来操作Windows系统,例如隐藏/显示任务栏、打开/关闭任务管理器等。通过这些简单的代码,你可以方便地定制和控制你的Windows体验。代码示例和详细
bat
57B
2023-05-28 15:15
C#使用InteropPortableDeviceApiLib获取Windows Portable Devices信息
WindowsPortableDevices译作Windows便携设备(WPD)是一种驱动程序技术,可支持广泛的可移动设备,比如移动电话、数码相机和便携媒体播放器。这是完整实现,搜了很久才自己DIY搞
RAR
0B
2019-06-01 03:40