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

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#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.
 

rconn

Administrator
Staff member
May 14, 2008
10,205
86
#2
> 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.
Any reason you feel compelled to do this in FOR rather than DO?

Rex Conn
JP Software