Actions in Context MenusActions Basically, anything that appears in an Explorer context menu is an Action you can take on that particular File Type. For example, when you right-click on a Folder, the menu items include:
Explore Find... These are the Actions you can take on any Folder. One of these appear in bold type, and that one is defined as the Default Action: the Action that would happen if you double-clicked that folder instead of right-clicking it. File Types From Explorer, if you select the menu item View\Folder Options and select the File Types tab, you can view all the registered File Types, and by selecting any one of them and hitting the Edit... button, their related Actions. For any of these file types, you can Add an Action, Edit an existing Action to perform the way you desire, or change the Default Action (by simply selecting the Action you'd like to have be the default, then hitting the Set Default button). Adding Actions The Microsoft Power Toys has a utility which is nothing more than a new Action for the Drive and File Folder file types: Command Prompt Here. With that Action added, whenever you right-click on a Drive or Folder, you'll see a new option labeled "Command Prompt Here", which runs the following command:
...which opens CMD.EXE in the drive or folder on which you've right-clicked (the /k switch tells cmd.exe to run the command which follows, then remain open). Once you "install" this Power Toy, you can go to the Edit File Type dialog for Drive or File Folder, double-click the "Command Prompt Here" Action, hit "Edit", and see this command in the Edit box. So it goes that you could add any command you care to the context menu for particular file types. For example, you might want to have a DIR Listing for the File Folder file type:
c:\winnt\system32\cmd.exe /c dir /s "%1"> temp.txt & notepad.exe temp.txt & del temp.txt The /c switch closes the command window when the command is finished executing (in this case, when you finish viewing the file in Notepad, then close it). The files in the selected directory and sub-directories are output to a file (named "temp.txt"), which is then opened in Notepad, and then automatically deleted when Notepad is closed. Of course, you could get a lot fancier with your DIR command, adding switches to order the files by certain attributes or whatnot. And you could open the file in a different "viewer" besides Notepad, or output the listing directly to the printer. For directory listings, I like using Excel, which has the "Text to Columns" command, which makes sorting files a snap.
The copyright of the article Actions in Context Menus in Windows NT Workstation is owned by Tracey Kirkpatrick-Pritchett. Permission to republish Actions in Context Menus in print or online must be granted by the author in writing.
Go To Page: 1 2 Articles in this Topic Discussions in this Topic |