473,796 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6094
"Mike" <y1***@yahoo.co m> 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.superne ws.com>

--
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.co m> 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.superne ws.com>

--
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 GetShortPathNam e API:

Declare Auto Function GetShortPathNam e Lib "kernel32.d ll" _
(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\Longfilena me.txt"
Dim sb As New StringBuilder(2 56)
GetShortPathNam e(s,sb,sb.capac ity)

MsgBox(sb.ToStr ing)

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

Declare Auto Function GetShortPathNam e Lib "kernel32.d ll" _
(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\Longfilena me.txt"
Dim sb As New StringBuilder(2 56)
GetShortPathNam e(s,sb,sb.capac ity)

MsgBox(sb.ToStr ing)

Nov 21 '05 #5

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

Similar topics

4
1901
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 folders on that drive, then click a folder and it adds the next level of folders under the first, and so on. That part works perfectly with one flaw. but here is the flaw: When I add the next sub node it adds the entire path to the Node.Text the...
0
275
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 doing this? Thanks, Michael
2
28283
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 format without AM/PM? Thanks. Bob Hughes
1
7298
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: Creating library Release/fnimqcmd.lib and object Release/fnimqcmd.exp CoIMQCmd.obj : error LNK2001: unresolved external symbol
11
2737
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
6510
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" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
0
2154
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. It seems that they're using the default "short date" format. I want to use the "long date" format to display the actual hour/minute/
0
1596
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" and viceversa. I found this source: ************************************************************** double dPowI = ceil( log10( (double)iLen / ( ((double)wBitsPerSample / 8 ) + wChannels - 1 ) ) / log10( 2.0 ) ); int iNearTwoPower = (int)pow(...
1
1351
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
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10239
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.