Application path
How to get path of file(ex:test.txt) currently running in c#.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 7, 2012, 2:32 PM
However, to get the file path you would need to get its handle and use that to fish it out of kernel memory which would require the use of a driver. This can be done in C/C++ but would be very difficult from managed code which can only run in user mode.
If you don't mind a bit of C++, then I'd check this article:
http://www.codeproject.com/Articles/18975/Listing-Used-Files
brunda kPosted Apr 7, 2012, 10:27 PM
Sam HobbsPosted Apr 7, 2012, 9:11 PM
brunda kPosted Apr 7, 2012, 5:27 AM
say i have Test.txt file running(open) then thru the above code i am getting
Process notepad: C:\Windows\system32\NOTEPAD.EXE.
But my requirment is to get
Application Name: Test.txt
Path of Application : c:/Tempfolder
SenthilkumarPosted Apr 7, 2012, 4:34 AM
You can get all the files which are currently running in the operating system.
If you get the file name then you can get the path.
foreach (Process p in Process.GetProcesses())
To get the current application execution path,
http://www.csharp-examples.net/get-application-directory/