C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to find the windows folder and other special folders.


Posted Date: 30 Apr 2006    Resource Type: Articles    Category: .NET Framework
Author: Tony JohnMember Level: Gold    
Rating: Points: 10



Many developers assume windows path will be C:\\Winnt and hardcode this path in code.

It need not be true in all cases. Also, the windows path varies by operating system. So, it is a good idea to programmatically find the windows path instead of assuming it.

Here is the code to find the windows root path:

Environment.GetEnvironmentVariable("SystemRoot")

Alternatively, you can access another environment variable to find the windows directory.

Environment.GetEnvironmentVariable("windir")

The above calls will return the correct windows path for any windows operating system.

You can use the above approach to find various other special folders including users default folder, program file folder etc.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Creating a Singleton Object
Previous Resource: ViewState - behind the scenes
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use