Help and Support

How to add the Print Directory feature for folders in Windows XP and in Windows Vista

Article ID:321379
Last Review:March 21, 2008
Revision:5.0
This article was previously published under Q321379
On This Page

INTRODUCTION

This article describes how to add the Print Directory feature for folders in Windows XP and in Windows Vista. After you follow the steps that are described in the "More Information" section, you can right-click a folder and then click Print Directory Listing to print a directory listing of the contents of a folder.

Back to the top

MORE INFORMATION

Windows XP

Step 1: Create the Printdir.bat file

To do this, follow these steps:
1.Click Start, click Run, type notepad, and then click OK.
2.Paste the following text into Notepad:
@echo off
dir %1 /-p /o:gn > "%temp%\Listing"
start /w notepad /p "%temp%\Listing"
del "%temp%\Listing"
exit
3.On the File menu, click Exit, and then click Yes to save the changes.
4.In the Save As dialog box, type the following text, and then click Save:
%windir%\Printdir.bat

Step 2: Create a new action for file folders

1.Click Start, click Control Panel, and then click Folder Options.

Or, click Start, point to Settings, click Control Panel, and then click Folder Options.
2.On the File Types tab, click File Folder.
3.Click Advanced, and then click New.
4.In the Action box, type Print Directory Listing.
5.In the Application used to perform action box, type printdir.bat.
6.Click OK.
7.Click OK two times, and then click Close.

Step 3: Edit the registry

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/) How to back up and restore the registry in Windows

After you follow the steps in the previous sections, Search Companion may start when you double-click a folder instead of the folder being opened. Or, if you have associated other actions with file folders, those actions may be performed instead.

To resolve this issue, follow these steps:
1.Start Registry Editor.
2.Locate the Default value under the following registry subkey:
HKEY_CLASSES_ROOT\Directory\shell
3.On the Edit menu, click Modify.
4.In the Value data box, type none.
5.Click OK.
6.Exit Registry Editor.

Back to the top

Windows Vista

Step 1: Create the Printdir.bat file

To do this, follow these steps:
1.Click Start, click Run, type notepad, and then click OK.
2.Paste the following text into Notepad:
@echo off
dir %1 /-p /o:gn > "%temp%\Listing"
start /w notepad /p "%temp%\Listing"
del "%temp%\Listing"
exit
3.On the File menu, click Exit, and then click Yes to save the changes.
4.In the Save As dialog box, type the following text, and then click Save:
%windir%\Printdir.bat

Step 2: Edit the registry

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/) How to back up and restore the registry in Windows
1. Start Registry Editor.
2.Locate the following registry key:
HKEY_CLASSES_ROOT\Directory\shell
3.On the Edit menu, click New, and then click Key. Type Print Directory Listing, and then press ENTER.
4.Select Print Directory Listing, click New on the Edit menu, and then click Key.
5.Enter a command for the name of the new subkey, and then press ENTER.
6. Double-click the default entry that is listed in the "command" subkey.
7.In the Value data box, type Printdir.bat.
8. Click OK, and then exit Registry Editor.

Back to the top


APPLIES TO
Microsoft Windows XP Home Edition
Microsoft Windows XP Professional
Windows Vista Business
Windows Vista Enterprise
Windows Vista Home Basic
Windows Vista Home Premium
Windows Vista Starter
Windows Vista Ultimate

Back to the top

Keywords: 
kbenv kbhowtomaster KB321379

Back to the top

Article Translations

 

Other Support Options

  • Contact Microsoft
    Phone Numbers, Support Options and Pricing, Online Help, and more.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.