PC Review


Reply
Thread Tools Rate Thread

Convert long filenames to 8.3 format?

 
 
Terry Pinnell
Guest
Posts: n/a
 
      8th Apr 2007
Although probably not directly on-topic, I'm hoping the experts here
can help please. How I can automatically convert a long filename like
C:\Program Files\This example.exe to a DOS 8.3 name like
C:\Progra~1\Thisex~1.exe ?

I'm sure I've seen some clever way to do it from an XP Explorer or My
Computer folder, but I'm darned if I can find it. I recall something
like dragging the file into a Command Prompt window, but when I try
that it merely displays the original long name.

The reason I want to do this is to place 'shortcuts' in text files. My
text editor, TextPad, lets me r-click strings like the following to go
directly to the targets:

http://www.example.com to go to a website

file://D:/Docs/Example.txt to open that file on my HD

file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
Example.txt' on my HD

So, taking that last example, I want to be able to select the file
D:\Docs\This Example.txt in say an XP folder, and get
D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
manually. Rather like the indispensable MS Powertoys TweakUI facility
'Send to > Clipboard as a name'.

--
Terry, West Sussex, UK
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      8th Apr 2007

"Terry Pinnell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Although probably not directly on-topic, I'm hoping the experts here
> can help please. How I can automatically convert a long filename like
> C:\Program Files\This example.exe to a DOS 8.3 name like
> C:\Progra~1\Thisex~1.exe ?
>
> I'm sure I've seen some clever way to do it from an XP Explorer or My
> Computer folder, but I'm darned if I can find it. I recall something
> like dragging the file into a Command Prompt window, but when I try
> that it merely displays the original long name.
>
> The reason I want to do this is to place 'shortcuts' in text files. My
> text editor, TextPad, lets me r-click strings like the following to go
> directly to the targets:
>
> http://www.example.com to go to a website
>
> file://D:/Docs/Example.txt to open that file on my HD
>
> file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
> Example.txt' on my HD
>
> So, taking that last example, I want to be able to select the file
> D:\Docs\This Example.txt in say an XP folder, and get
> D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
> manually. Rather like the indispensable MS Powertoys TweakUI facility
> 'Send to > Clipboard as a name'.
>
> --
> Terry, West Sussex, UK


I don't think you can do this, simply because the conversion from
LFNs to SFNs does not result in a predetermined SFN. The final
name depends on what's already in the current folder. You can see
this for yourself by creating two files:
a) "This Example.txt"
b) "This Ex.txt"

The SFN will be depend on which file you create first.

Create "This Example.txt" first:
08/04/2007 21:30 3 THISEX~1.TXT This Example.txt
08/04/2007 21:31 3 THISEX~2.TXT This Ex.txt

Create "This Ex.txt" first:
08/04/2007 21:32 3 THISEX~1.TXT This Ex.txt
08/04/2007 21:32 3 THISEX~2.TXT This Example.txt

Any tool that can do this must read the access the LFN on the
disk and check the corresponding SFN.


 
Reply With Quote
 
Alan Edwards
Guest
Posts: n/a
 
      8th Apr 2007
I am sure I have come across what you want but cannot find it.
The closest I have is a VBS script from Bill James (7 years old for
Win98) called FileFldrInfo.vbs
It does not appear on Bill's page at http://www.billsway.com/vbspage/
so you may try getting in touch with him.
The info in the file:

'FileFldrInfo.vbs - Create right click context menu and
'SendTo shortcut to get file and folder information.
'Options for DOS 8.3 path or name or long path or name.
'Requires Windows 98 or Internet Explorer 5.01 +.
'To install, double click this file.
'© Bill James - - rev 30 Jan 2000

....Alan
--
Alan Edwards, MS MVP Windows - Internet Explorer
http://dts-l.org/index.htm



On Sun, 08 Apr 2007 11:50:17 +0100, in
microsoft.public.windowsxp.general, Terry Pinnell
<(E-Mail Removed)> wrote:

>Although probably not directly on-topic, I'm hoping the experts here
>can help please. How I can automatically convert a long filename like
>C:\Program Files\This example.exe to a DOS 8.3 name like
>C:\Progra~1\Thisex~1.exe ?
>
>I'm sure I've seen some clever way to do it from an XP Explorer or My
>Computer folder, but I'm darned if I can find it. I recall something
>like dragging the file into a Command Prompt window, but when I try
>that it merely displays the original long name.
>
>The reason I want to do this is to place 'shortcuts' in text files. My
>text editor, TextPad, lets me r-click strings like the following to go
>directly to the targets:
>
>http://www.example.com to go to a website
>
>file://D:/Docs/Example.txt to open that file on my HD
>
>file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
>Example.txt' on my HD
>
>So, taking that last example, I want to be able to select the file
>D:\Docs\This Example.txt in say an XP folder, and get
>D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
>manually. Rather like the indispensable MS Powertoys TweakUI facility
>'Send to > Clipboard as a name'.

 
Reply With Quote
 
Poprivet
Guest
Posts: n/a
 
      8th Apr 2007
Terry Pinnell wrote:
> Although probably not directly on-topic, I'm hoping the experts here
> can help please. How I can automatically convert a long filename like
> C:\Program Files\This example.exe to a DOS 8.3 name like
> C:\Progra~1\Thisex~1.exe ?
>
> I'm sure I've seen some clever way to do it from an XP Explorer or My
> Computer folder, but I'm darned if I can find it. I recall something
> like dragging the file into a Command Prompt window, but when I try
> that it merely displays the original long name.
>
> The reason I want to do this is to place 'shortcuts' in text files. My
> text editor, TextPad, lets me r-click strings like the following to go
> directly to the targets:
>
> http://www.example.com to go to a website
>
> file://D:/Docs/Example.txt to open that file on my HD
>
> file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
> Example.txt' on my HD
>
> So, taking that last example, I want to be able to select the file
> D:\Docs\This Example.txt in say an XP folder, and get
> D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
> manually. Rather like the indispensable MS Powertoys TweakUI facility
> 'Send to > Clipboard as a name'.


I don't understand what you're trying to do, but any app that requires SFN
will have t hem created them on its own; you shouldn't have to mess with
them at all.
XP is unlike 98 et al in that it doesn't use the SFNs underneath the LFNs
so it's not, AFAIK, possible or at least not easy to do.


 
Reply With Quote
 
Wesley Vogel
Guest
Posts: n/a
 
      8th Apr 2007
dir /x
Displays the short names generated for files on NTFS and FAT volumes. The
display is the same as the display for /n, but short names are displayed
after the long name.


--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:(E-Mail Removed),
Terry Pinnell <(E-Mail Removed)> hunted and pecked:
> Although probably not directly on-topic, I'm hoping the experts here
> can help please. How I can automatically convert a long filename like
> C:\Program Files\This example.exe to a DOS 8.3 name like
> C:\Progra~1\Thisex~1.exe ?
>
> I'm sure I've seen some clever way to do it from an XP Explorer or My
> Computer folder, but I'm darned if I can find it. I recall something
> like dragging the file into a Command Prompt window, but when I try
> that it merely displays the original long name.
>
> The reason I want to do this is to place 'shortcuts' in text files. My
> text editor, TextPad, lets me r-click strings like the following to go
> directly to the targets:
>
> http://www.example.com to go to a website
>
> file://D:/Docs/Example.txt to open that file on my HD
>
> file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
> Example.txt' on my HD
>
> So, taking that last example, I want to be able to select the file
> D:\Docs\This Example.txt in say an XP folder, and get
> D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
> manually. Rather like the indispensable MS Powertoys TweakUI facility
> 'Send to > Clipboard as a name'.
>
> --
> Terry, West Sussex, UK


 
Reply With Quote
 
Bill James
Guest
Posts: n/a
 
      8th Apr 2007
There is a script on my web site to do this, but it will take a little manual configuration to implement. Go to http://billsway.com/notes_public/ and download "Clipboard as 8.3 Path.vbs". Save that someplace on the hard drive where you won't accidentally delete it, then add a shortcut in the SendTo folder (C:\Documents and Settings\[username]\SendTo).

The script uses the "InternetExplorer.Application" object, but the IE Security settings may not allow the script access to the clipboard with current settings. The only way to solve that is to modify your IE Security settings, but if you are careful about how you do that the risk is minimal. Open IE, Tools, Internet Options, then on the Security tab select Trusted sites, the Sites button, and add "about:clipcopy" to the sites list. You may also have to adjust the security settings for Trusted Zone to allow clipboard access. Understand that doing so allows any site in the Trusted sites list to access the clipboard, but you really shouldn't be adding any site there that you can't, well, Trust.

With that all done, you can select a file or folder in Windows Explorer, right click, select Send To, then the new item "Clipboard as 8.3 Path". Multiple files and/or folders are allowed, but if you select too many long paths you will get an error for maximum length exceeded.

--

Bill James


"Terry Pinnell" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Although probably not directly on-topic, I'm hoping the experts here
> can help please. How I can automatically convert a long filename like
> C:\Program Files\This example.exe to a DOS 8.3 name like
> C:\Progra~1\Thisex~1.exe ?
>
> I'm sure I've seen some clever way to do it from an XP Explorer or My
> Computer folder, but I'm darned if I can find it. I recall something
> like dragging the file into a Command Prompt window, but when I try
> that it merely displays the original long name.
>
> The reason I want to do this is to place 'shortcuts' in text files. My
> text editor, TextPad, lets me r-click strings like the following to go
> directly to the targets:
>
> http://www.example.com to go to a website
>
> file://D:/Docs/Example.txt to open that file on my HD
>
> file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
> Example.txt' on my HD
>
> So, taking that last example, I want to be able to select the file
> D:\Docs\This Example.txt in say an XP folder, and get
> D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
> manually. Rather like the indispensable MS Powertoys TweakUI facility
> 'Send to > Clipboard as a name'.
>
> --
> Terry, West Sussex, UK

 
Reply With Quote
 
cquirke (MVP Windows shell/user)
Guest
Posts: n/a
 
      9th Apr 2007
On Sun, 08 Apr 2007 11:50:17 +0100, Terry Pinnell

>Although probably not directly on-topic, I'm hoping the experts here
>can help please. How I can automatically convert a long filename like
>C:\Program Files\This example.exe to a DOS 8.3 name like
>C:\Progra~1\Thisex~1.exe ?


Dir /X will show the actual short names, whereas what you see with the
%~s1 logic may be spurious (as that works even if the file or path
doesn't exist).

Let's test that... hmm, seems as if the logic is:
- if exists, show the 8.3 name
- if does not exist, show the given name

That's better than generating faux short names, and is OK if you
combine it with If Exist logic, or other "existance" tests.

>I'm sure I've seen some clever way to do it from an XP Explorer or My
>Computer folder, but I'm darned if I can find it.


In Win95/98, Properties would show you the real 8.3 name of a file,
but this was stripped out in WinME. Silly, as there are times when
you DO have to pay attention to the man behind the curtain.

>I recall something like dragging the file into a Command Prompt
>window, but when I try that it merely displays the original long name.


Command.com is LFN-aware, but the behavior can change if it dips into
a LFN-unaware context. You can test this yourself; start a Cmd or
Command prompt in (say) "C:\Program Files" and do a few things; at
some point, the command prompt will switch to C:\PROGRA~1 and once it
does, it generally won't switch back for the rest of that session.

>The reason I want to do this is to place 'shortcuts' in text files. My
>text editor, TextPad, lets me r-click strings like the following to go
>directly to the targets:
>
>http://www.example.com to go to a website
>
>file://D:/Docs/Example.txt to open that file on my HD
>
>file://D:/Docs/Thisex~1.txt to open the file 'D:\Docs\This
>Example.txt' on my HD
>
>So, taking that last example, I want to be able to select the file
>D:\Docs\This Example.txt in say an XP folder, and get
>D:\Docs\Thisex~1.txt onto the clipboard, without having to do it
>manually. Rather like the indispensable MS Powertoys TweakUI facility
>'Send to > Clipboard as a name'.


Does it help to "use quotes for names with spaces"?



>-------------------- ----- ---- --- -- - - - -

Tip Of The Day:
To disable the 'Tip of the Day' feature...
>-------------------- ----- ---- --- -- - - - -

 
Reply With Quote
 
cquirke (MVP Windows shell/user)
Guest
Posts: n/a
 
      9th Apr 2007
On Sun, 8 Apr 2007 11:10:59 -0400, "Poprivet"

> XP is unlike 98 et al in that it doesn't use the SFNs underneath the LFNs
>so it's not, AFAIK, possible or at least not easy to do.


That's not true, if file system is FATxx.

On NTFS, AFAIK there are still 8.3 names stored, unless you explicitly
disable that; if you do, then certain things can break.

NT OSs such as XP differ in how 8.3 indexes are incrimented after the
"first few" cases. Whereas Win9x will go BLAHBL~1, BLAHBL~2,
BLAHBL~3, .. BLAHB~87 etc., at some point an NT-based OS will switch
to a hexadecimal "8" stub for the name.

This, and other LFN issues, can bedevil attempts to predict what will
happen and accurately find files via 8.3 names etc.



>---------- ----- ---- --- -- - - - -

Do it once, properly
>---------- ----- ---- --- -- - - - -

 
Reply With Quote
 
Terry Pinnell
Guest
Posts: n/a
 
      9th Apr 2007
"Bill James" <(E-Mail Removed)> wrote:

>There is a script on my web site to do this, but it will take a little manual configuration to implement. Go to http://billsway.com/notes_public/ and download "Clipboard as 8.3 Path.vbs". Save that someplace on the hard drive where you won't accidentally delete it, then add a shortcut in the SendTo folder (C:\Documents and Settings\[username]\SendTo).
>
>The script uses the "InternetExplorer.Application" object, but the IE Security settings may not allow the script access to the clipboard with current settings. The only way to solve that is to modify your IE Security settings, but if you are careful about how you do that the risk is minimal. Open IE, Tools, Internet Options, then on the Security tab select Trusted sites, the Sites button, and add "about:clipcopy" to the sites list. You may also have to adjust the security settings for Trusted Zone to allow clipboard access. Understand that doing so allows any site in the Trusted sites list to access the clipboard, but you really shouldn't be adding any site there that you can't, well, Trust.
>
>With that all done, you can select a file or folder in Windows Explorer, right click, select Send To, then the new item "Clipboard as 8.3 Path". Multiple files and/or folders are allowed, but if you select too many long paths you will get an error for maximum length exceeded.


Many thanks to all for those helpful replies. The simple Dir /x
approach is almost enough in itself, but that 'Send To...' tool is
just the job - excellent!

The method of adding %20 would indeed seem to be a promising solution,
but unfortunately it doesn't work! I had previously been in touch with
TextPad's author, who said:

---------
"According to RFC1738 (http://www.faqs.org/rfcs/rfc1738.html), spaces
are not valid in URLs and have to be represented by their 2-digit hex
character code, preceded by "%". Hence, using your example, you must
type:
file://D:/Program%20Files/
Unfortunately, Microsoft are too clever by half when interpreting
URLs, so this doesn't work either! The problem is, instead of passing
it straight on to a web browser, which understands URLs, the shell
parses strings starting with "file://", to determine which application
should display the folder or file. This is actually what you want,
but unfortunately the parser does not interpret the hex codes, so
cannot find the file or folder and rejects the request."
---------

--
Terry, West Sussex, UK
 
Reply With Quote
 
Terry Pinnell
Guest
Posts: n/a
 
      10th Apr 2007
Terry Pinnell <(E-Mail Removed)> wrote:

>"Bill James" <(E-Mail Removed)> wrote:
>
>>There is a script on my web site to do this, but it will take a little manual configuration to implement. Go to http://billsway.com/notes_public/ and download "Clipboard as 8.3 Path.vbs". Save that someplace on the hard drive where you won't accidentally delete it, then add a shortcut in the SendTo folder (C:\Documents and Settings\[username]\SendTo).
>>
>>The script uses the "InternetExplorer.Application" object, but the IE Security settings may not allow the script access to the clipboard with current settings. The only way to solve that is to modify your IE Security settings, but if you are careful about how you do that the risk is minimal. Open IE, Tools, Internet Options, then on the Security tab select Trusted sites, the Sites button, and add "about:clipcopy" to the sites list. You may also have to adjust the security settings for Trusted Zone to allow clipboard access. Understand that doing so allows any site in the Trusted sites list to access the clipboard, but you really shouldn't be adding any site there that you can't, well, Trust.
>>
>>With that all done, you can select a file or folder in Windows Explorer, right click, select Send To, then the new item "Clipboard as 8.3 Path". Multiple files and/or folders are allowed, but if you select too many long paths you will get an error for maximum length exceeded.

>
>Many thanks to all for those helpful replies. The simple Dir /x
>approach is almost enough in itself, but that 'Send To...' tool is
>just the job - excellent!
>
>The method of adding %20 would indeed seem to be a promising solution,
>but unfortunately it doesn't work! I had previously been in touch with
>TextPad's author, who said:
>
>---------
>"According to RFC1738 (http://www.faqs.org/rfcs/rfc1738.html), spaces
>are not valid in URLs and have to be represented by their 2-digit hex
>character code, preceded by "%". Hence, using your example, you must
>type:
>file://D:/Program%20Files/
>Unfortunately, Microsoft are too clever by half when interpreting
>URLs, so this doesn't work either! The problem is, instead of passing
>it straight on to a web browser, which understands URLs, the shell
>parses strings starting with "file://", to determine which application
>should display the folder or file. This is actually what you want,
>but unfortunately the parser does not interpret the hex codes, so
>cannot find the file or folder and rejects the request."
>---------


I subsequently had an even neater solution from Michael Bednarek in
another group. Unknown to me for all the years that I've used
Powertoys TweakUI, if you press the Ctrl key while selecting 'Send To
> Clipboard as Name', it will place the file's *short* name onto the

clipboard. Exactly what I need!

--
Terry, West Sussex, UK
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
3.8 filenames if file select box in xp long filenames appeared in Ernie Windows XP Help 0 18th Oct 2008 05:57 AM
How to convert Date stored in Long Integer format to mm/dd/ccyy =?Utf-8?B?VGhlaw==?= Microsoft Access 2 17th Feb 2006 06:27 PM
Convert long integer to time format Lawlee Microsoft Access 5 13th Oct 2005 12:53 PM
How to convert a long integer number to time format Lawlee Microsoft Access External Data 2 13th Oct 2005 10:09 AM
vb.net convert filenames to 8.3 format Thom Microsoft VB .NET 3 14th May 2004 04:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:46 PM.