473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to get filename?

Hi,

I can have code like:
Application.ExecutablePath
to return something like "c:\blah\myapp.exe"

I only want "c:\blah\myapp" (or even just "myapp") to return, is there some
other code I can use? Otherwise, I'll have to trim the ".exe".

In the end I want to build a string like "c:\blah\myapp.config".

Thanks.
Nov 15 '05 #1
4 2661
Path.GetFileNameWithoutExtension

or even

Path.ChangeExtension

(they do your work for you!)
"Pluto" <Pl***@Pluto.com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
Hi,

I can have code like:
Application.ExecutablePath
to return something like "c:\blah\myapp.exe"

I only want "c:\blah\myapp" (or even just "myapp") to return, is there some other code I can use? Otherwise, I'll have to trim the ".exe".

In the end I want to build a string like "c:\blah\myapp.config".

Thanks.

Nov 15 '05 #2
Thanks Michael
"Michael A. Covington" <lo**@www.covingtoninnovations.com.for.address> wrote
in message news:Ov**************@TK2MSFTNGP10.phx.gbl...
Path.GetFileNameWithoutExtension

or even

Path.ChangeExtension

(they do your work for you!)
"Pluto" <Pl***@Pluto.com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
Hi,

I can have code like:
Application.ExecutablePath
to return something like "c:\blah\myapp.exe"

I only want "c:\blah\myapp" (or even just "myapp") to return, is there

some
other code I can use? Otherwise, I'll have to trim the ".exe".

In the end I want to build a string like "c:\blah\myapp.config".

Thanks.


Nov 15 '05 #3
I must say C# and the available functionality in the .NET framework amazes
me time and time again. I don't know how any of these very
detaillistic/specific issues I've seen being solved by STANDARD solutions!

May I cheer out loud and be happy to embarked on the this C# ship !?

"Michael A. Covington" <lo**@www.covingtoninnovations.com.for.address> wrote
in message news:Ov**************@TK2MSFTNGP10.phx.gbl...
Path.GetFileNameWithoutExtension

or even

Path.ChangeExtension

(they do your work for you!)
"Pluto" <Pl***@Pluto.com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
Hi,

I can have code like:
Application.ExecutablePath
to return something like "c:\blah\myapp.exe"

I only want "c:\blah\myapp" (or even just "myapp") to return, is there

some
other code I can use? Otherwise, I'll have to trim the ".exe".

In the end I want to build a string like "c:\blah\myapp.config".

Thanks.


Nov 15 '05 #4
Indeed, the .NET Framework is almost perfect. A great mix of simplicity and
power.
"Stu Banter" <x2**************@westerterp.com> wrote in message
news:3f***********************@news.xs4all.nl...
I must say C# and the available functionality in the .NET framework amazes
me time and time again. I don't know how any of these very
detaillistic/specific issues I've seen being solved by STANDARD solutions!

May I cheer out loud and be happy to embarked on the this C# ship !?

"Michael A. Covington" <lo**@www.covingtoninnovations.com.for.address> wrote in message news:Ov**************@TK2MSFTNGP10.phx.gbl...
Path.GetFileNameWithoutExtension

or even

Path.ChangeExtension

(they do your work for you!)
"Pluto" <Pl***@Pluto.com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
Hi,

I can have code like:
Application.ExecutablePath
to return something like "c:\blah\myapp.exe"

I only want "c:\blah\myapp" (or even just "myapp") to return, is there

some
other code I can use? Otherwise, I'll have to trim the ".exe".

In the end I want to build a string like "c:\blah\myapp.config".

Thanks.



Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: S.W. Rasmussen | last post by:
With the risk of being accused of multi-posting I would like to draw the attention to a serious visual basic/windows issue discussed in the microsoft.public.vb.bugs newsgroup. As pointed out below...
11
by: hokiegal99 | last post by:
How would I determine if a filename is greater than a certain number of characters and then truncate it to that number? For example a file named XXXXXXXXX.txt would become XXXXXX fname = files...
4
by: Michael | last post by:
All, I'll asked a question but I was not detailed (clear) enough for people to help so I'll retry. I have a cgi script pass a variable from one page to the next. The 'receiving' page replaces...
10
by: Brian Gruber | last post by:
Hi, I'm looking for a way to rename a whole directory of files in short order. The files in the directory have different lengths, however all of them end with _xxxx the x's represent a randomly...
8
by: Lad | last post by:
Hello, what is a way to get the the extension of a filename from the path? E.g., on my XP windows the path can be C:\Pictures\MyDocs\test.txt and I would like to get the the extension of the...
12
by: IamIan | last post by:
I searched the archives but couldn't find anyone else with this problem. Basically I'm grabbing all ASCII files in a directory and doing geoprocessing on them. I need to calculate a z-factor based...
4
by: B Squared | last post by:
I'm trying to pass a filename (which is a jpeg image) to a php function / file so that it will display. I know that its simple to get PHP to display an image hardcoding in the filename. For...
10
by: Steve | last post by:
I am trying to create a downloader which will bypass the saveas box in the WebBrowser control. I have the file downloading, but I don't know what the filename is that is being passed through the...
0
by: jinnareddy | last post by:
Hi, I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL...
12
by: vj | last post by:
I am using Borland C++. I run a program which generates output data files, say 'Voltage.dat', 'Current.dat'. I have a variable in my code (say N), and for various values of N (for each value of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.