DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Using Unix Shell's Backquote Functionality In DOS/Windows Batch Files

08.05.2005
| 12484 views |
  • submit to reddit
        In BAT files, an equivalent of a Unix shell's
set foo `bar`

can be accomplished as

bar>bar.tmp
set /p foo=<bar.tmp

If you're spoiled by Unix's notion of 
true pipes, note that the following:

bar | set /p foo=

does not work.