Home All Groups Group Topic Archive Search About

Console app & Base path

Author
9 Jan 2007 2:43 PM
ThunderMusic
Hi,
I have a console app. I have to search for files in the directory from which
my application is run. Here's an example :

c:\MyApp>MyApp.exe param1 param2

The base path is C:\MyApp...  but if I do the following :

c:\MyApp\SubDir>..\MyApp.exe param1 param2

The base path should be C:\MyApp\Subdir...  Is there a way to get this
value?  I tried AppDomain.CurrentDomain.BaseDirectory, but it always returns
c:\MyApp...

Please help... ;)

ThunderMusic

Author
9 Jan 2007 3:02 PM
ThunderMusic
I found it in the Environment properties.

Thanks

Show quote
"ThunderMusic" <NoSpAmdanlatathotmaildotcom@NoSpAm.com> wrote in message
news:%23yXLEy$MHHA.3952@TK2MSFTNGP02.phx.gbl...
> Hi,
> I have a console app. I have to search for files in the directory from
> which my application is run. Here's an example :
>
> c:\MyApp>MyApp.exe param1 param2
>
> The base path is C:\MyApp...  but if I do the following :
>
> c:\MyApp\SubDir>..\MyApp.exe param1 param2
>
> The base path should be C:\MyApp\Subdir...  Is there a way to get this
> value?  I tried AppDomain.CurrentDomain.BaseDirectory, but it always
> returns c:\MyApp...
>
> Please help... ;)
>
> ThunderMusic
>
>
Author
10 Jan 2007 10:11 AM
Skanda
Use the Application's StartUpPath property

Show quote
"ThunderMusic" wrote:

> Hi,
> I have a console app. I have to search for files in the directory from which
> my application is run. Here's an example :
>
> c:\MyApp>MyApp.exe param1 param2
>
> The base path is C:\MyApp...  but if I do the following :
>
> c:\MyApp\SubDir>..\MyApp.exe param1 param2
>
> The base path should be C:\MyApp\Subdir...  Is there a way to get this
> value?  I tried AppDomain.CurrentDomain.BaseDirectory, but it always returns
> c:\MyApp...
>
> Please help... ;)
>
> ThunderMusic
>
>
>

AddThis Social Bookmark Button