Home Page

 


EARLIER FEATURES

 


FEATURES CONTENTS

 


LATER FEATURES

 

Features Contents


15th February 2004

QUICK EXIT TO DOS PROMPT FROM A WINDOWS EXPLORER FOLDER

Brian Grainger

email.gif (183 bytes)
brian@grainger1.freeserve.co.uk


 

One of the things I have always wanted to do is select a folder in Windows Explorer and then open up a DOS prompt in that folder. I can use this to quickly execute a DOS command on the files within that folder. For example, executing:

dir > prn

would be a quick way of getting a print of the directory.

By a small change to the Registry one can create a new entry on the right-click context menu of a folder that, if selected, will open up a DOS prompt. Here are the steps for making this change to the Registry. I am assuming the reader is reasonably proficient at editing the registry and knows what to do if they corrupt it!

Click the Start button and select Run

Type Regedit and hit return

Go to the Key

HKEY_CLASSES_ROOT\Folder\shell

Right click this key

select New - Key from the context menu

The new key appears with a temporary name

Type a name for the new key, e.g. DosPrompt, and then press ENTER

When the new key is created a Default value is created, (for string data), under the key

Select this value, right click and select Modify from the context menu

In the box labelled
Value data

type:
DOS &Prompt
and click OK

RegEdit View 1

The data typed is what appears on the context menu when a folder in Windows Explorer is right clicked. In this case I want DOS Prompt, with the P being used as the character to type if I want to select this option using the keyboard. D has already been used for Delete, which is why I chose the P. The & before the P in the value data indicates I want the P to be underlined when the context menu is displayed.

Select the new DosPrompt Key

Right click this key and select New - Key from the context menu

The new key appears with a temporary name

Type the following as the name for the new key:
command
and then press ENTER.

When the new key is created a Default value is created, (for string data), under the key

Select this value, right click and select Modify from the context menu

In the box labelled
Value data

type the following data:
command.com /k cd %1 (Windows 9x)
cmd.exe /k cd %1 (Windows NT, 2K, XP)
and then click OK

RegEdit View 2

That is all there is to it. The changes made take effect immediately without rebooting the PC. Within Windows Explorer right click a Folder and you will see a DOS Prompt option.

15 Jan 06

I have now got a PC at work where the Administrator has disabled write access to the parts of the registry needed to implement the above trick.

If anyone knows how to do it without editing the registry, please e-mail me!

20 Apr 2006

Graham Lattin provided the answer, (for a Windows XP machine), to my question above:

Create a shortcut in your Send To folder with the target of:
C:\WINNT\system32\cmd.exe /k cd /d
(If necessary, replace C:\WINNT\system32\ with wherever cmd lives on your machine).

This executes the cd command with the selected drive and directory as the parameter and then stays active.


 

 

 

 


TOP