By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,476 Members | 889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,476 IT Pros & Developers. It's quick & easy.

finding a file in a console app

P: n/a
I'm writing a console app and want to read an XML file that will be in the
same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
how about
Application.ExecutablePath

HTH

Shane

"G. Dean Blake" <De**@nospam.com> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I'm writing a console app and want to read an XML file that will be in the
same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G

Nov 20 '05 #2

P: n/a
The Application class is a Windows.forms class. I's not available in a
console application.

no?
G
"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:Os*************@TK2MSFTNGP11.phx.gbl...
how about
Application.ExecutablePath

HTH

Shane

"G. Dean Blake" <De**@nospam.com> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I'm writing a console app and want to read an XML file that will be in the same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G


Nov 20 '05 #3

P: n/a
well one way to do it is might be

".\whatever"

I have used that in apps and seems to work.

let me know.
"G. Dean Blake" <De**@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
The Application class is a Windows.forms class. I's not available in a
console application.

no?
G
"SStory" <Th*******@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
news:Os*************@TK2MSFTNGP11.phx.gbl...
how about
Application.ExecutablePath

HTH

Shane

"G. Dean Blake" <De**@nospam.com> wrote in message
news:O$**************@tk2msftngp13.phx.gbl...
I'm writing a console app and want to read an XML file that will be in the same directory as my .exe file. If I were in a web app I could do:

Dim xtr As New XmlTextReader(server.mappath("myfile.xml"))

but I don't know how to find the path in a console app.

thanks,

G



Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.