Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: dragon-itPosted on 2009-09-22 at 15:41:23ID: 25398259
You can do it using either a for command or set /p:
echoit -s >file.txt & set /p var1=<file.txt
For some reason I've never been able to get it to work properly using a pipe.
or with for:
for /f "tokens=*" %%a in ('echoit -s') do set var1=%%a
If the results have more than one line then var1 will end up the last line with the for and the first line with the set /p, though we can easily do processing with the for command to get whichever bit of the output is needed (some examples in for /? set /? etc.)
Steve