c# 获取相对路径,操作环境变量.

来源:互联网 发布:淘宝上的李宁是真的吗 编辑:程序博客网 时间:2024/06/05 15:33
c# 获取相对路径,操作环境变量.一、获取当前文件的路径1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName // Get the current directory.            string path = Directory.GetCurrentDirectory();获取模块的完整路径,包括文件名。2. System.Environment.CurrentDirectory获取和设置当前目录(该进程从中启动的目录)的完全限定目录。......C# 如何获取某用户的“我的文档”的目录        static string myDocPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);System.Environment.GetFolderPath 方法获取指向由指定枚举标识的系统特殊文件夹的路径。

0 0
原创粉丝点击