ho i'm converting a my project from vb6 to vb.net Is there an analog method in vb.net of shortpath?
Dim DestinationFile As Scripting.File
...
DestinationFile.ShortPath
Thanks
No, modern languages are not built to use short paths, but you can use the GetShortPathName method from the kernel:
Declare Auto Function GetShortPathName Lib "kernel32.dll" _
(ByVal lpszLongPath As String, ByVal lpszShortPath As StringBuilder, _
ByVal cchBuffer As Integer) As Integer
Call using:
Dim name As String = "C:\Long Directory Name\Really really long filename.txt"
Dim sb As New StringBuilder(256)
GetShortPathName(name, sb, sb.capacity)
Dim shortName As String = sb.ToString()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With