Click here to Skip to main content
16,018,394 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C:\Documents and Settings\purplelab>path

PATH=C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;c:\Program Files\Mi
crosoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS
\Binn\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;c:\Program Files\Microsoft SQL
Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Common Files\Adobe\
AGL

how to get these paths in c#?
Posted
Updated 5-Nov-12 6:51am
v2
Comments
Suraj S Koneri 5-Nov-12 5:45am    
clearly mention what you want to ask..
manuthebos 5-Nov-12 6:07am    
when we type the "path" on command prompt these location are printed. i want to get programmatically these directories location.
MT_ 5-Nov-12 6:56am    
Did the solution below helped?

The answer is clearly mentioned in
http://msdn.microsoft.com/en-us/library/77zkk0b6.aspx

Read the link carefully.
 
Share this answer
 
You can use
C#
Console.WriteLine(Environment.GetEnvironmentVariable("Path"));


This will give you path as you want.

Hope that helps. If it does, mark the answe /upvote.

Thanks
Milind
 
Share this answer
 
Hi
you can get filepaths and system filepaths using the C# directories class

here is a link http://msdn.microsoft.com/en-us/library/system.io.directory.aspx[^]

Happy Coding!

Storxstar
 
Share this answer
 
Comments
manuthebos 5-Nov-12 6:02am    
which function is to be used ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900