1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Force For to treat set of values as text, not files

Discussion in 'Support' started by David Marcus, Jun 20, 2010.

  1. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    How can I force the For command to treat the set of values as strings rather than files? Consider the following btm file:

    for /t" " %X in (%@right[-%@len[%@field[0,%cmdline]],%cmdline]) (echo %X)

    If I run this with an argument of *, it will print out a list of the files in the directory. I want it to just print *.

    The purpose of this is that I want to make some changes to the command line (e.g., add some default parameters), then run a program using the modified command line.
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    Any reason you feel compelled to do this in FOR rather than DO?

    Rex Conn
    JP Software
     
  3. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    None at all. Thank you.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,040
    Likes Received:
    84
    Then use DO /L, which tells DO that the arguments are strings, not
    filenames.

    Rex Conn
    JP Software
     

Share This Page