473,805 Members | 1,896 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 6098
"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
1902
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
28284
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
7300
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
2738
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
6513
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
2155
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
1352
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
9716
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
9596
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
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
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
10105
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7646
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
6876
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
5542
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...
2
3845
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.