Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add a right-click directory listing option
#1

Add a right-click directory listing option for 9x, 2K, XP

 

Ok so it would be real handy if we could right click any windows directory and have the option to print a listing of whats inside, open the contents in notepad and print from there, or even list the contents by file type right?

Well I'm here to tell you how to do it so pay attention.

 

Very first thing we need to do is make some batch files to add to the C:\winnt directory or C:\windows depending on your operating system.

We will be using notepad to make the batch files. To make simple batch files with it, open it up and choose file save as and in the Save As Type area of the Save As dialogue box choose all files. You must do this so that it doesnt save it as batch.bat.txt. Name your batch files with a .bat extension.

Another way its to is to click START > RUN and type cmd (NT,2K,XP) or command (Win9x) to bring up a command prompt, and type this at the prompt:

 

echo > test.bat

 

This will create a batch file and all you have to do to open and edit is right click on it and choose edit.

 

Ok now make a batch file named DirList.bat and add the following code in it and save:

 

dir /B %1 /-p /o:gn > "%temp%\Dir Listing"

start notepad "%temp%\Dir Listing"

 

Make another one that will list by subdirectories called DirListSub.bat with the following code:

 

dir /s %1 /-p /o:gn > "%temp%\Dir Listing"

start notepad "%temp%\Dir Listing"

 

 

Make another one called DirListPrint.bat for sending the listing straight to the printer if you want by using this code:

 

dir %1 /-p /o:gn > "%temp%\Dir Listing"

start /w notepad /p "%temp%\Dir Listing"

del "%temp%\Dir Listing"

 

You can remove the /B if you want a full date and time listing to go along with it. For more information on that open a command prompt and type dir /? for help.

 

Ok so we got all our batch files made and if your clever it doesn't have to stop there, but let's move on.

We now need to edit the registry to use these batch files and add the entries to the right click menu.

I have made some .reg files that will automate this process. Just copy the following code into notepad and save as a .reg file.

 

AddRightClick.reg

<-- start copy under this line -->

Windows Registry Editor Version 5.00

 

[HKEY_CLASSES_ROOT\Directory\shell]

@=""

 

[HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents]

 

[HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents\command]

@="C:\\WINNT\\DirList.bat \"%1\""

 

[HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents With SubDirectories]

 

[HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents With SubDirectories\command]

@="C:\\WINNT\\DirListSub.bat \"%1\""

 

[HKEY_CLASSES_ROOT\Directory\shell\Print Folder Contents to Default Printer]

 

[HKEY_CLASSES_ROOT\Directory\shell\Print Folder Contents to Default Printer\command]

@="C:\\WINNT\\DirListPrint.bat \"%1\""

 

<-- end copy -->

 

To Remove:

DelRightClick.reg

<-- start copy under this line -->

 

Windows Registry Editor Version 5.00

 

[HKEY_CLASSES_ROOT\Directory\shell]

@=""

 

[-HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents]

 

[-HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents\command]

@="C:\\WINNT\\DirList.bat \"%1\""

 

[-HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents With SubDirectories]

 

[-HKEY_CLASSES_ROOT\Directory\shell\List Folder Contents With SubDirectories\command]

@="C:\\WINNT\\DirListSub.bat \"%1\""

 

[-HKEY_CLASSES_ROOT\Directory\shell\Print Folder Contents to Default Printer]

 

[-HKEY_CLASSES_ROOT\Directory\shell\Print Folder Contents to Default Printer\command]

@="C:\\WINNT\\DirListPrint.bat \"%1\""

 

<-- end copy -->

 

You may have to modify the paths in these files to suite your Operating System, like C:\WINNT for NT, 2K, and XP and C:\WINDOWS for Win9x.

 

Once you have made all the files and got them in the proper place you can double click the reg files and it will make the proper adjustments. You will then notice that when you right click on a file that you have new options.

 

To make a right click option to list contents by file type:

 

First lets make a directory under C:\ to hold some files. Make a directory and call it whatever you wish.

Im going to call mine "batchscripts".

 

Now in this directory lets create some batch files.

Create one like DOC.bat and insert this code in it and save:

 

dir %1\*.%~n0 /-p /o:gn > "%temp%\Dir Listing"

start notepad "%temp%\Dir Listing"

 

Now for each aditional extension just copy the batch file and rename it to the extension you wish to use like XLS.bat , BMP.bat , TXT.bat , and so on.

 

Now open up:

C:\Documents and Settings\YourUserName\SendTo (2K, XP)

C:\WINNT\Profiles\YourUserName\SendTo (NT4)

C:\WINDOWS\SendTo (Win9x)

 

Make a directory called Print File Listings or what ever you like.

In that directory create shortcuts to the batch files in the c:\batchscripts directory.

All done. Now just right click a folder and select SendTo from the right click menu and then choose the file type you want a listing of and walla.

 

More tips can be found over at [/url][url=http://www.thebatchfile.com/tips.php]http://www.thebatchfile.com/tips.php

Reply
#2

Actually,

 

Just recently I've wanted to get more into scripting, so I've been messing around with a few things. However, the RightClick.reg is very nice to know, I think I've found something else to mess around with windows.

 

Better backup. [img]<___base_url___>/uploads/emoticons/default_wacko.png[/img]

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)