Thanks, but yeah I don't mean that. I want to substitute the output of one command as a parameter of another. For example in the BASH shell you could type something like "rm `cat del.txt`" and if the contents of del.txt were "number.txt" and number.txt was in the current folder it would be deleted.
If your output is going to a file, then you can read the output using for /f and run commands against it. It's a bit of a gnarly command for getting the syntax right, but here's reading from a file with a single parameter per line:
FOR /F "eol=; tokens=1* delims= " %i in (myfile.txt) do <command> %i
If you run it from a batch, those variables need double percent signs ie: %%i. Substitute <command> for the actual command. The %i is a convention - if you have more than one token/parameter per line, they become %j, %k, etc etc
You can capture output directly from a command and use it to execute something too:
FOR /F "usebackq delims==" %i IN (`<command>`) DO <anothercommand> %i
I suggest you run help for in the command prompt and see all the gubbins it goes on about...
PS. And if you need to really convoluted processing of the input/output, I suggest you just use Perl ;-)
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.