what's the best way to convert a long path with things like "Documents and Settings" in it to a 8.3 path with things like "Docum~1" in it?
-John
8.3 paths with ~
Moderators: Susan Smith, admin, Gabriel
8.3 paths with ~
Back in the days when Windows gave us long file names and DOS didn't know what to do with them the "Docum~1" came to pass. I assumed Windows kept a cross reference table of both names. I don't know if it was dynamic or stayed assigned for the life of the path. "Docum~1" would be "Docum~2" and "Docum~3" based on the number of "Documents and Settings" that existed or anything longer that 8 characters that started with "Docum". I wonder if when the "Docum~2" path was removed if "Docum~3" would revert to "Docum~2"? That could create user maintained table issues. I suppose if you controlled the path parts that you were abbreviating you could use the "config substitute" command to re-expand when needed. I am not sure this is what you were trying to accomplish or not. When BR gave us the "full" path along with the DOS path in the BR DIR command it solved my issues.
-
- Posts: 717
- Joined: Sun Aug 10, 2008 4:24 am
- Location: Southern California
dir @::C:\windows
Directory of @::C:\windows\*.*
. <DIR> 09/29/11 7:20a .
.. <DIR> 09/29/11 7:20a ..
addins <DIR> 07/14/09 1:32a addins
APPCOM~1 <DIR> 07/13/09 11:20p AppCompat
AppPatch <DIR> 08/10/11 3:23a AppPatch
assembly <DIR> 09/23/11 10:30a assembly
atiogl xml 19017 12/08/09 10:41p atiogl.xml
ativpsrm bin 0 03/01/11 3:20a ativpsrm.bin
bfsvc exe 71168 11/20/10 9:24a bfsvc.exe
BITLOC~1 <DIR> 09/23/11 7:30a BitLockerDiscoveryVolumeContents
in BR, the 8.3 name is displayed in the 1st 13 characters.
If it's not, then there is no 8.3 name.
Directory of @::C:\windows\*.*
. <DIR> 09/29/11 7:20a .
.. <DIR> 09/29/11 7:20a ..
addins <DIR> 07/14/09 1:32a addins
APPCOM~1 <DIR> 07/13/09 11:20p AppCompat
AppPatch <DIR> 08/10/11 3:23a AppPatch
assembly <DIR> 09/23/11 10:30a assembly
atiogl xml 19017 12/08/09 10:41p atiogl.xml
ativpsrm bin 0 03/01/11 3:20a ativpsrm.bin
bfsvc exe 71168 11/20/10 9:24a bfsvc.exe
BITLOC~1 <DIR> 09/23/11 7:30a BitLockerDiscoveryVolumeContents
in BR, the 8.3 name is displayed in the 1st 13 characters.
If it's not, then there is no 8.3 name.
-
- Posts: 717
- Joined: Sun Aug 10, 2008 4:24 am
- Location: Southern California
Okay - thanks for everyone's input. For me this is a one time process during startup - And I don't want to do any guessing - I want it to always be correct... also I didn't want to take a long time to write a solution - SO - I've developed a little dos batch file to call. It looks something like this:
echo off
if '%1'=='' goto HELP
if '%2'=='' goto HELP
set homepath="%~1"
set homedir=%~d1
for %%A in (%HOMEPATH%) do set HOMEPATH=%%~spnxA
echo %homedir%%homepath%
echo %homedir%%homepath% >%2
goto XIT
:HELP
echo Proper Usage is:
echo %0 [path_input] [outputfile]
echo [path_input] - a long path to parse. quote encapsulation is required
echo i.e. "C:\Long Path To Parse\etc"
echo [outputfile] - file to output resulting short path to.
:XIT
Thank you all!
echo off
if '%1'=='' goto HELP
if '%2'=='' goto HELP
set homepath="%~1"
set homedir=%~d1
for %%A in (%HOMEPATH%) do set HOMEPATH=%%~spnxA
echo %homedir%%homepath%
echo %homedir%%homepath% >%2
goto XIT
:HELP
echo Proper Usage is:
echo %0 [path_input] [outputfile]
echo [path_input] - a long path to parse. quote encapsulation is required
echo i.e. "C:\Long Path To Parse\etc"
echo [outputfile] - file to output resulting short path to.
:XIT
Thank you all!