获取系统当前目录

Posted on 2019-01-07 23:00  努力成长静待花开  阅读(216)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  Environment类的CurrentDirectory属性    //获取或设置当前工作目录的完全限定路径

  public static string CurrentDirectory {get;  set;}

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = Environment.CurrentDirectory;
        }