C # Get the current file working path comparison between two ways

Source: Internet
Author: User

two ways to get or set the current work path in C #:

the difference between Application.startuppath and System.Environment.CurrentDirectory


For example, you can start the program on your desktop, but in the middle you use a OpenFileDialog to open a file in the folder of e disk named ABC, then currentdirectory becomes E:\ABC, So if you want to get a file on the Startup folder again, it's useless.


But Application.startuppath will not be like this, no matter which disk you open in the middle of the file, the boot path is on the desktop there, has not changed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.