Google Answers Logo
View Question
 
Q: how do I get the short 8.3 filename AND path?? ( No Answer,   16 Comments )
Question  
Subject: how do I get the short 8.3 filename AND path??
Category: Computers > Operating Systems
Asked by: baz229-ga
List Price: $10.00
Posted: 17 May 2005 13:58 PDT
Expires: 16 Jun 2005 13:58 PDT
Question ID: 522710
in Windows XP how do I get in a cut & pasteable form the short
filename AND path?? ... short => ms dos 8.3 format

preferably without needing to install any software

I've found that at a DOS prompt dir /x will give me the short file
name BUT not the path in short form

TIA

Clarification of Question by baz229-ga on 18 May 2005 07:36 PDT
>[zigger-ga] Did this answer your question?
I don't think so!

I could already get the short FILEname BUT not the short PATHname ... EASILY.

Eg if I want the short PATH name for "C:\Program Files\Windows Media
Player". How do I get it EASILY?

I could go to C:\ and do dir prog*.* /x to get
PROGRA~1  for   Program Files
and then go to C:\Program Files and do dir win*.* /x to get
WINDOW~2  for   Windows Media Player

AND thus my SHORT path for
C:\Program Files\Windows Media Player
is
C:\PROGRA~1\WINDOW~2

BUT what a painful method ;-( ... and even worse if I had deeper folders.

Can you help??
Answer  
There is no answer at this time.

Comments  
Subject: Re: how do I get the short 8.3 filename AND path??
From: zigger-ga on 18 May 2005 02:20 PDT
 
In Windows XP SP2 i did the following from the windows directory using
a command prompt e.g. Start>Run>cmd then press enter:-

dir *. /x 

and got the following:-

02/10/2004  11:52    <DIR>          REGIST~2     RegisteredPackages
31/12/2004  02:38    <DIR>          REGIST~1     Registration
18/06/2004  23:40    <DIR>                       repair
18/06/2004  23:40    <DIR>          RESOUR~1     Resources
22/01/2005  20:20    <DIR>                       security
19/06/2004  15:50    <DIR>          SERVIC~1     ServicePackFiles
29/10/2004  18:08    <DIR>                       SHELLNEW
12/08/2004  11:21    <DIR>          SOFTWA~1     SoftwareDistribution
09/12/2004  20:38    <DIR>                       speech
13/08/2004  14:25    <DIR>                       srchasst
18/07/2004  16:56    <DIR>                       Sun
22/01/2005  20:26    <DIR>                       system
22/01/2005  20:26    <DIR>                       system32
22/01/2005  07:46    <DIR>                       Temp
22/01/2005  20:22    <DIR>                       twain_32
02/10/2004  12:34    <DIR>          UNINST~1     uninstall
22/01/2005  20:25    <DIR>                       Web
06/01/2005  23:27    <DIR>                       WinSxS
               0 File(s)              0 bytes
              50 Dir(s)  19,859,374,080 bytes free

C:\WINDOWS>

Notice the middle column with the short names?

Then from yout command prompt window click the c:\ icon , choose edit
then mark. Now you can highlight an area and press enter. You info
will now be in the windows clipboard so you can paste into another
application.

Did this answer your question?

Regards

Chris
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 18 May 2005 07:36 PDT
 
>[zigger-ga] Did this answer your question?
I don't think so!

I could already get the short FILEname BUT not the short PATHname ... EASILY.

Eg if I want the short PATH name for "C:\Program Files\Windows Media
Player". How do I get it EASILY?

I could go to C:\ and do dir prog*.* /x to get
PROGRA~1  for   Program Files
and then go to C:\Program Files and do dir win*.* /x to get
WINDOW~2  for   Windows Media Player

AND thus my SHORT path for
C:\Program Files\Windows Media Player
is
C:\PROGRA~1\WINDOW~2

BUT what a painful method ;-( ... and even worse if I had deeper folders.

Can you help??
Subject: Re: how do I get the short 8.3 filename AND path??
From: bavi_h-ga on 21 May 2005 15:12 PDT
 
Here is something I tried in Windows 95. Maybe it works the same in Windows XP.

1. Open the folder of the file you want the short name for.
2. Open a Command Prompt.
3. Drag and drop the file onto the Command Prompt window. On my
Windows 95, this types out the complete short path and filename.

Now you have to copy and paste that text from the Command Prompt.
Click on the System menu (the top-left icon) and choose Edit, Mark.
Now select the text with the mouse. Then click the System menu and
choose Edit, Copy.
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 22 May 2005 08:05 PDT
 
>[bavi_h-ga] ... in Windows 95. Maybe it works the same in Windows XP.
>.. this types out the complete short path and filename.

On my Win XP it unfortunately gives me the LONG path & file name in ""/quotes ;-(

If there's a way to get it to display the SHORT filename & path this
would be a great method!
Subject: Re: how do I get the short 8.3 filename AND path??
From: realegor-ga on 26 May 2005 06:30 PDT
 
If you can run DOS and go to directory.It shows the path in the
prompt.Or ,run Norton Commndr,its old version print short names in the
top of the panel.
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 26 May 2005 10:28 PDT
 
>realegor-ga on 26 May 2005 06:30 PDT     
Thanks for the reply

>If you can run DOS and go to directory.It shows the path in the
>prompt.

At least in my Win XP it shows the LONG path. I want the short path.
Do you know if I can I make a temporary setting or similar so that it
will show the SHORT??

>Or ,run Norton Commndr,its old version print short names in the
>top of the panel.

I'm wanting to do this WITHOUT needing to install extra software.

Regards
Subject: Re: how do I get the short 8.3 filename AND path??
From: flajason-ga on 27 May 2005 10:28 PDT
 
What you're asking for cannot be done with the standard DIR command.
Here's a short VBScript alternative.
It won't take any wildcard characters or search subdirectories.

Just copy and paste the below into notepad and save it as something like vbdir.vbs

'Usage: 
' From a command line, change directories to the location
' where this script is saved.
' At the command line type: cscript vbdir.vbs [directory]
' ex. cscript vbdir.vbs "C:\Program Files"
' or cscript vbdir.vbs C:\Windows\System32

on error resume next
Set fso=CreateObject("Scripting.FileSystemObject")

Set objFolder = fso.GetFolder(WScript.Arguments(0))

Set objSubFolders = objFolder.SubFolders
For each sf in objSubFolders
   WScript.Echo sf.ShortPath
Next

Set objFiles = ObjFolder.Files
For each f in objFiles
   WScript.Echo f.ShortPath
Next
Subject: Re: how do I get the short 8.3 filename AND path??
From: flajason-ga on 27 May 2005 10:45 PDT
 
After my last comment, I read your clarifications a little closer.
The last script I posted was to list out an entire directory in 8.3 format.
If you are looking for a clipboard friendly way to retrieve the 8.3
for individual files, this will be more to your liking.

Same as before. Copy the below into notepad and save it with a .vbs extension.
Except this time, you can just drag and drop a folder or file icon
onto the .vbs file and it will display the short path in an input box,
where you can copy the value and use for whatever you want it for.

If you're feeling industrious, you can also save the .vbs file in your
"Send To" folder (C:\Documents and Settings\[yourname]\SendTo) to have
it available in your context menu with a right-click.


Set fso=CreateObject("Scripting.FileSystemObject")

' Is object a file or folder?
If fso.FolderExists(WScript.Arguments(0)) Then
   'It's a folder
   Set objFolder = fso.GetFolder(WScript.Arguments(0))
   rtrn = InputBox("Here's your short path:", "SHORT PATH", objFolder.ShortPath)
End If

If fso.FileExists(WScript.Arguments(0)) Then
   'It's a file
   Set objFile = fso.GetFile(WScript.Arguments(0))
   rtrn = InputBox("Here's your short path:", "SHORT PATH", objFile.ShortPath)
End If
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 27 May 2005 12:24 PDT
 
>From: flajason-ga on 27 May 2005 10:45 PDT
What a GREAT solution :-) You exceeded by expectations by orders of
magnitude. This is great. Please claim this as an answer!! :-)
Subject: Re: how do I get the short 8.3 filename AND path??
From: flajason-ga on 27 May 2005 12:53 PDT
 
I would if I could, but I have not yet reached the coveted position of
Google Researcher.
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 27 May 2005 13:56 PDT
 
>From: flajason-ga on 27 May 2005 12:53 PDT 
can I cancel the question then & post you a check? ... & how do we
communicate NOT in public?

otherwise does said coveted google researcher come along now & claim
the bootie? ... the huge amount that it is ;-)
Subject: Re: how do I get the short 8.3 filename AND path??
From: bumpher-ga on 27 May 2005 14:08 PDT
 
The BEST and simplest way to do this in windows xp is to use the
command.exe rather than cmd.exe . Click start, run, type in command
then press enter. These 2 programs are 2 totally different programs.
Command is the windows 32bit version of the command prompt. cmd is
available in windows as of windows 2000 and is the "new" command shell
provided that adds additional features as well as other changes. I
don't know them all but using command rather than cmd automatically
displays short files names and paths.
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 27 May 2005 16:25 PDT
 
>From: bumpher-ga on 27 May 2005 14:08 PDT     
> ... use the command.exe rather than cmd.exe .

command.exe didn't work for me but plain command did

and it does display the SHORT path

BUT it seems getting to the directory/directory/etc that I want the
sort path name for requires knowing the short path name ;-( ... ie
exactly my problem!

for example say I want the short path to C:\Program Files\NetMeeting

if do paste the long path after a cd command ie
CD C:\Program Files\NetMeeting 
in a command shell it fails & says too many parameters. 

If I paste a short path after a cd command ie 
CD C:\PROGRA~1\NETMEE~1
it works fine BUT I used my answer to find my answer

I could traverse one folder at a time BUT when I've got many levels of
folders that gets hard.

Maybe I'm missing something ;-(
Subject: Re: how do I get the short 8.3 filename AND path??
From: bumpher-ga on 29 May 2005 00:57 PDT
 
You're right, my mistake, it is command.com not command.exe. At any
rate, I am not understanding what your are saying. You need to use the
long filename again?
Subject: Re: how do I get the short 8.3 filename AND path??
From: manuka-ga on 02 Jun 2005 02:42 PDT
 
There's a simple way to do it:

run cmd.exe and do the following:

cd "long path name"
command

Then command.com will come up and display the short path name.
Subject: Re: how do I get the short 8.3 filename AND path??
From: baz229-ga on 02 Jun 2005 08:08 PDT
 
>From: manuka-ga on 02 Jun 2005 02:42 PDT 
Brilliant!! ... thanks. Nice cause this doesn't involve code or any software :-)

If "flajason-ga on 27 May 2005" hadn't come up with theirs before
you'd get the credit for sure. A nice thing with flajason-ga's is it
works even for UNC path's :-) Something I didn't even realise was
important to me.

Thanks!

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy