1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Expanding wildcards in command-line

Discussion in 'Windows XP' started by chuckmg, 2004/07/18.

Thread Status:
Not open for further replies.
  1. 2004/07/18
    chuckmg Contributing Member

    chuckmg Inactive Thread Starter

    Joined:
    2002/01/08
    Messages:
    236
    Likes Received:
    0
    I want to process a series of files with a batch file using an argument such as file*. Is it possible to get the expansion of file* into a list of the file names? My need is to access and change each file and rewrite it back with a name related to the original. Not possible to create a file with a name of file*.

    Chuck
     
  2. 2004/07/18
    Newt

    Newt Inactive

    Joined:
    2002/01/07
    Messages:
    10,974
    Likes Received:
    2
    I'm having a little trouble visualizing exactly what you are trying to do. Could you put in an example (doesn't need to work) just to illustrate specifically what you are about doing.
     
    Newt,
    #2

  3. to hide this advert.

  4. 2004/07/18
    chuckmg Contributing Member

    chuckmg Inactive Thread Starter

    Joined:
    2002/01/08
    Messages:
    236
    Likes Received:
    0
    Sure Newt.

    Have in a directory files x1, x2, x3.

    bat file chgfile.bat:
    -------------------

    :getfile
    if "%1 "==" " goto end
    rename %1 tmp
    sed "s/\&lt;/\</" tmp > %1
    del tmp
    shift
    goto getfile
    :end
    set tofile=
    echo All done

    > chgfile x1 x2 x3
    is ok. But

    > chgfile x*
    is NOT


    With a directory full of files to change, writing them out on the command-line is not a good solution. Any help would be appreciated.

    Chuck
     
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.