faqts : Computers : Programming : Languages : Batch language : 4DOS

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 3 people (33%) answered Yes
Recently 1 of 3 people (33%) answered Yes

Entry

4DOS/4NT: How to convert the path long filename (LFN) to/from short filename (SFN), in 4DOS?

Nov 8th, 2001 19:10
Knud van Eeden,


------------------------------------------------------------------------
--- Knud van Eeden - 9 November - 06:08 am -----------------------------

Idea:

Use the functions @LFN and @SFN to convert from long to short and
vice versa.
Then use redirection (e.g. echo and '>') to get this information in any 
program that has access to 4DOS.

---

method:

To convert from a short filename to a long filename,
use 4DOS, and the command @LFN

e.g. on the 4DOS command line, type the command:

 echo %@LFN[ <your short filename> ]

this will show the long filename.

---

For example:

 echo %@LFN[ C:\progra~1\pearso~1\cyberc~1\plugin~1\8701d7\POST_A~1.PL ]

shows the long filename:

 C:\Program Files\Pearson PTG\Cyber Classroom\plugin-bin\8701d7
\post_assessment.pl

---
---

To convert from a long filename to a short filename,
use 4DOS, and the command @SFN

e.g. on the 4DOS command line, type the command:

 echo %@SFN[ <your long filename> ]

this will show the short filename.

---

For example:

 echo %@LFN[ C:\Program Files\Pearson PTG\Cyber Classroom\plugin-
bin\8701d7\post_assessment.pl ]

shows the short filename:

 C:\progra~1\pearso~1\cyberc~1\plugin~1\8701d7\POST_A~1.PL

---
---

method:

To convert the long filename to a short filename you can use the 4DOS 
command:

 dir /f /x <your filename>

or similar:

 dir /fx <your filename>

------------------------------------------------------------------------