Solved

How do i get the path of the executable in window console application(C#)?

Posted on 2007-11-27
1
1,436 Views
Last Modified: 2013-12-16
Hi,

How do i find the path of the executable in a windows console application (C# code)?
I tried "Application.StartupPath".It did not work,got a compile error "the name 'application' does not exist  in this context"

Thanks..
0
Comment
Question by:Kiran_M
1 Comment
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 50 total points
Comment Utility
Hi Kiran_M;

This will do it.
String path = Environment.CurrentDirectory;

Documentation
http://msdn2.microsoft.com/en-us/library/system.environment.currentdirectory(VS.80).aspx

Fernando
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now