Last June I explained how to place a shortcut in your right-click menu that creates a new folder. It's a handy technique, but it works only one folder at a time--a limitation that also applies to the BxNewFolder freeware I described in last August's column.
Creating several folders at once--including subfolders within those new folders--requires only a very simple three-line batch file and (sometimes) a quick fix of a Windows bug. To create the batch file, open Notepad or your favorite text editor, and on the first line, type @echo off. Press <Enter>, and on the second line, type set /p name="Type folder name(s): ". (Be sure to use straight "typewriter" quotes. If you're using Notepad, you should get straight quotation marks automatically.) When you run the batch file, this line prompts you to type one or more names for your new folders and stores them in the variable 'name'. Press <Enter> again, and on the third and final line of the batch file, type md %1\%name%, and press <Enter> one more time. This line will create the new folder (via the 'md' or 'make directory' command) in the current folder (%1\) using the items that you entered and stored inside the variable (%name%). Choose File, Save, navigate to a folder in which you store your batch files (such as 'c:\batch'), type a name like make_dir.cmd, and click Save.
To add your batch file to the right-click menu for folders, open a folder or Explorer window (pressing <Windows>-E is one way) and choose Tools, Folder Options, File Types. Scroll through the list of registered file types and select File Folder. Click Advanced to open the Edit File Type dialog box, and choose the New button. For 'Action', type the command name that will appear on your context menu, such as Make Many Folders. For 'Application used to perform action,' type the complete file path and name of your batch file followed by a space and "%1"--for example, e:\apps\batch\make_dir.cmd "%1" (your path and file name may differ). Click OK twice and Close to return to Explorer.
Unfortunately, if you make a mistake while entering text in the New Action dialog box, you have to use the Registry Editor to fix it. To be safe, create a backup of your Registry first (go to "Step-By-Step: Care and Feeding of the Windows Registry" for instructions). With your Registry backed up, choose Start, Run, type regedit, and press <Enter>. In the tree pane on the left, navigate to and double-click HKEY_CLASSES_ROOT\Directory\shell. Select the folder with the name of the command you just added (for example, 'Make Many Folders'), double-click the (Default) icon in the right pane to open the command line in the Edit String dialog box, and make any corrections. To delete your custom command altogether, close the dialog box, right-click the folder in the left pane, choose Delete, and click Yes to confirm the change. For more details, go to "Remove Unsolicited Junk From Your Context Menus" and scroll down to "Resort to Regedit" in my December 2004 column.
Windows Bug Alert! When you create this shortcut in Windows XP (and any other time you open the Edit File Type dialog box in that OS), a bug is likely to change what happens when you double-click a folder. The problem is easy to fix, but it requires editing the Windows Registry. Click here for instructions from last August's column.
Now when you want to make one or more folders (including folders nested within folders), right-click any folder and choose Make Many Folders (or whatever you named your command; see FIGURE 1). A command-prompt window will appear asking for the names of your new folders. Type each name separated by a space. If you want your folder names to include spaces, put the names in quotation marks. To make a folder within a folder, type a backward slash (\) between the folder name and the name of its nested folder. When you're done, press <Enter> to create all the folders. For example, type 01-Jan\Draft 01-Jan\Final 02-Feb\Draft 02-Feb\Final 03-Mar\Draft 03-Mar\Final and press <Enter> to create the folders that are shown in FIGURE 2. Select the parent folder and press * on the numeric keypad to quickly expand all the branches in the tree pane as shown in the figure.






"Windows Tips: The Quickest Way to Make Several Folders at Once" Comments