Click here to Skip to main content
15,946,342 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi can anybody please provide proper answer for "How to get full file path from file name?"
Ex: I provide: string filename = @"test.txt";
I Required: Full File Path = C:\Windows\ABC\Test\test.txt
Om Prakash Pant 1-Nov-12 6:59am    
Your question is not clear. you provide file name and you need full path of file?
test.tx is in same folder?
p.ranjeeth 1-Nov-12 7:53am    
My requirement is we will install our application in merchant system, it will load application exe file in that system. I need to locate that exe file.

Try this:
string full = System.IO.File.Directory.GetCurrentDirectory() + "\\" + "test.txt";

Hope this helps.
Share this answer
to get full file path from file name .
Share this answer
From that, you can't get the full path from the filename, unless the file is present in your current working directory. If this is the case, you can use Assembly.GetExecutingAssembly().Location.
Share this answer

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