Riaan Lehmkuhl's Blog

Subversion, Progamming, Tips & Tricks and whatever else springs to mind.
04Nov

Get DOS 8.3 short name with VbScript

04 November 2009 10:26 by Riaan Lehmkuhl
Create a new text file called shortname.vbs Open in notepad and paste the following code in it:
set fso = CreateObject("Scripting.FileSystemObject") 
strLongName = Wscript.Arguments(0)
strShortName = "Invalid File/Folder - (" & strLongName & ")"
Set fsoFile = Nothing
On Error Resume Next
Set fsoFile = fso.GetFile(strLongName)
if Err.number <> 0 then
Set fsoFile = fso.GetFolder(strLongName)
end if
if fsoFile is not nothing then
strShortName = fsoFile.ShortPath
end if
Wscript.Echo strShortName
Run the script using cscript:
cscript shortname.vbs "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"
You will then get the following output:
C:\PROGRA~1\Adobe\READER~1.0\Reader\AcroRd32.exe

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

12/1/2009 7:39:07 PM #

oes tsetnoc contest

It appears that you've put a good amount of effort into your article and I require a lot more of these on the web these days. I sincerely got a kick out of your post. I do not have a bunch to to say in reply, I only wanted to register to say tremendous work.

oes tsetnoc contest United States

12/6/2009 1:15:09 PM #

hidup untuk berbagi

thanks info in this article is very good and interesting

hidup untuk berbagi United States

12/14/2009 2:05:23 PM #

Online bachelor degree

thanks for sharing the code. I want to give it a try and will update it here.

Online bachelor degree Argentina

12/24/2009 7:43:21 PM #

Berani Gagal

Great post. I really enjoyed reading it and I love the picture!! I am all for the no boss get. They get in the way and hold a truego getter back.

Berani Gagal

Comments are closed

Riaan Lehmkuhl


Me, a disorder of the brain that results in a disruption in a person's thinking, mood, and ability to relate to others.

Recent comments

Comment RSS

Thingies

Calendar And Month List

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Disclaimer & Privacy

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Privacy:
We use third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

Most comments

Cool Quote

I know that you believe that you understood what you think I said, but I am not sure you realize that what you heard is not what I meant. - Robert McCloskey