FOR Command Does Not Support Long Filenames in Windows 95 (138154)



The information in this article applies to:

  • Microsoft Windows 95

This article was previously published under Q138154

SYMPTOMS

When you use the MS-DOS FOR command in Windows 95, long filenames (LFNs) may not be handled correctly in MS-DOS sessions or with LAN Manager version 2.11 servers.

CAUSE

When you use the FOR command in Windows 95, LFN support is turned off. This behavior is by design.

RESOLUTION

Use the "LFNFOR ON" command before you execute a FOR command in a batch file.

For example, the following batch file displays all LFNs on the screen:
   @echo off
   lfnfor on
   for %%I in (*.*) do echo %%I
				
In this example, the "LFNFOR ON" command causes LFNs to be displayed correctly. A file named "New Text Document.txt" is displayed with its full name. Without the "LFNFOR ON" command, the file would be displayed with its 8.3 filename of "Newtex~1.txt."

MORE INFORMATION

The LFNFOR command enables and disables LFN support when processing FOR commands. Use "LFNFOR ON" to enable LFN support, and "LFNFOR OFF" to disable LFN support.

Type "lfnfor" without a parameter to display the current setting. The default value is LFNFOR OFF.

Modification Type:MajorLast Reviewed:12/17/2000
Keywords:KB138154