473,385 Members | 1,912 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,385 software developers and data experts.

Get "short" path

Hi,

I use some old application that need "short path" - previous dos style.
For example , I need to convert "C:\MyLongPath\1.txt" to
"c:\mylong~1\1.txt". Does exist any classes at vb.net for doing this?
Thanks,
Michael

Nov 21 '05 #1
4 6066
"Mike" <y1***@yahoo.com> schrieb:
I use some old application that need "short path" - previous dos style.
For example , I need to convert "C:\MyLongPath\1.txt" to
"c:\mylong~1\1.txt". Does exist any classes at vb.net for doing this?


See (complete thread):

<URL:http://www.google.de/groups?threadm=10a7pli2k0e4cde%40corp.supernews.co m>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
"Mike" <y1***@yahoo.com> schrieb:
I use some old application that need "short path" - previous dos style.
For example , I need to convert "C:\MyLongPath\1.txt" to
"c:\mylong~1\1.txt". Does exist any classes at vb.net for doing this?


See (complete thread):

<URL:http://www.google.de/groups?threadm=10a7pli2k0e4cde%40corp.supernews.co m>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
You can try the GetShortPathName API:

Declare Auto Function GetShortPathName Lib "kernel32.dll" _
(ByVal lpszLongPath As String, ByVal lpszShortPath As
StringBuilder, _
ByVal cchBuffer As Integer) As Integer

Call it like this:

Dim s As String = "c:\Long Dir Name\Longfilename.txt"
Dim sb As New StringBuilder(256)
GetShortPathName(s,sb,sb.capacity)

MsgBox(sb.ToString)

Nov 21 '05 #4
You can try the GetShortPathName API:

Declare Auto Function GetShortPathName Lib "kernel32.dll" _
(ByVal lpszLongPath As String, ByVal lpszShortPath As
StringBuilder, _
ByVal cchBuffer As Integer) As Integer

Call it like this:

Dim s As String = "c:\Long Dir Name\Longfilename.txt"
Dim sb As New StringBuilder(256)
GetShortPathName(s,sb,sb.capacity)

MsgBox(sb.ToString)

Nov 21 '05 #5

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

Similar topics

4
by: Tim Geiges | last post by:
I have created a treeview for my app that on MainFormLoad I have it get the list of drives with GetLogicalDrives() and populate the tree, then when I click the drive it adds the first level of...
0
by: Mike | last post by:
Hi, I use some old application that need "short path" - previous dos style. For example , I need to convert "C:\MyLongPath\1.txt" to "c:\mylong~1\1.txt". Does exist any classes at vb.net for...
2
by: rehughes | last post by:
When I use: Format(datetime, "Short Time") or Format(datetime, "t") or Format(datetime, "hh:mm") I always get an AM/PM value on the end of the time string. How do I get a short time in military...
1
by: sharmadeep1980 | last post by:
Hi All, I am facing a very unique problem while compling my project in "Release" build. The project is building in DEBUG mode but giving linking error on Release build. Here is the error:...
11
by: jobs239 | last post by:
Can I use this line inside C program "system(java -jar <jarfilename>)" to run a java program from C? Or do I have to use some JNI interface.?
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: Curious | last post by:
Hi, I have two columns defined as DateTime type in the Visual Designer, i.e., Dataset.xsd. In the grid to which the columns are bound, they're both displayed as date, for instance, 5/23/2007....
0
by: tarlino | last post by:
Hi! I'm play with the sound generation (c++ and directX). Now I would like to manage same filter on my sample. But now I must to convert my audio buffer "BYTE" (from DirectX) to an arry of "short"...
1
by: =?Utf-8?B?d2lsZG9y?= | last post by:
when I highlight the "short file" (result of internet download) ,and click delete, the response is "could not find this file", "verify the location and try again"
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.