bashbatch-filebackticks

Batch equivalent of Bash backticks


When working with Bash, I can put the output of one command into another command like so:

my_command `echo Test`

would be the same thing as

my_command Test

(Obviously, this is just a non-practical example.)

I'm just wondering if you can do the same thing in Batch.


Solution

  • You can do it by redirecting the output to a file first. For example:

    echo zz > bla.txt
    set /p VV=<bla.txt
    echo %VV%