Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2010
    Location
    Atlanta, GA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have been using a batch file for years in XP. It's not working in W7. What it does is allow me to click "Make Multiple Folders" on a folder's context menu, be prompted for the names of multiple folders, and the batch file is called to create those folders. The problem is (in W7) that it is only creating the first name. Here's the file:

    @echo off
    ECHO CREATE MULTIPLE FOLDERS IN ONE OPERATION
    echo.
    echo Make the target folder have focus!!!
    echo.
    echo Enter all folder names on one line separated by spaces
    echo and then press ENTER
    echo (Enclose folder names containing spaces in quotes)
    echo.
    set /p folders="Type folder name(s) and press Enter: "
    md %1\%folders%

    Is there something different about W7's cmd.exe processing vs. WXP? Any ideas gratefully accepted.

    BTW, the original idea for this is from an article by Scott Dunn in PC World Magazine in December 2005.

    A more complete description of this can be found at:

    http://edmullen.net/utility.php

    Ed Mullen

  2. #2
    5 Star Lounger
    Join Date
    Jan 2010
    Location
    Los Angeles, CA
    Posts
    828
    Thanks
    4
    Thanked 38 Times in 34 Posts
    I'm surprised that it works the way you said it did on XP (I'd have to fire up my XP VM to verify), especially with folder names separated by spaces. For example, I would suspect that:

    mkdir %1\lots of folders

    would create only %1\lots.

    Now with using backslahes, I could see it working because if command extensions are on, then md creates all intervening directories. For example:

    mkdir %1\lots\of\folders

    would create %1\lots and %1\lots\of and %1\lots\of\folders

  3. #3
    New Lounger
    Join Date
    Feb 2010
    Location
    Atlanta, GA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Peter Johnson2191 View Post
    I'm surprised that it works the way you said it did on XP (I'd have to fire up my XP VM to verify), especially with folder names separated by spaces. For example, I would suspect that:

    mkdir %1\lots of folders

    would create only %1\lots.

    Now with using backslahes, I could see it working because if command extensions are on, then md creates all intervening directories. For example:

    mkdir %1\lots\of\folders

    would create %1\lots and %1\lots\of and %1\lots\of\folders
    I assure you, it works fine in WXP.

    Try this in W7 ...

    Open a command prompt. Go to some directory (e.g. cd c:\)

    Type the following:

    md a b [enter]

    Then do:

    dir [enter]

    you will see directories "a" and "b" listed.

    My question is why does the batch file work in XP and not W7?

    Of course, you'll need to register the context menu command as described in the link I provided above.

  4. #4
    New Lounger
    Join Date
    Feb 2010
    Location
    Atlanta, GA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Solution provided by foxidrive on alt.msdos.batch.nt ...

    @echo off
    ECHO CREATE MULTIPLE FOLDERS IN ONE OPERATION
    ECHO.
    ECHO Make the target folder have focus!!!
    echo.
    ECHO Enter all folder names on one line separated by spaces
    echo and then press ENTER
    echo (Enclose folder names containing spaces in quotes)
    ECHO.
    set /p folders="Type folder name(s) and press Enter: "
    set "current=%~1"
    pushd "%current%
    for %%a in (%folders%) do md "%current%\%%~a"
    popd

    Just in case anyone cares.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •