1.

Solve : Batch file: how take program output as a variable??

Answer»

Hello everyone,

I am trying to accomplish what seems like a simple task, but having a hard TIME of it. What I want to do is TAKE the text output of a command line program and have it stored as a variable inside of a batch program.

For example: the 'ver' command outputs the local os version:

C:\>ver

Microsoft Windows 2000 [Version 5.00.2195]

How can I take that output and get it to a variable?

Thank you for any INFORMATION at all!!

katsuThis may help you out:

Code: [Select]
for /f "tokens=1* delims=#" %%a in ('ver') do set var=%%a


The delims=# forces an override of the default delimiters of space and tab.

Hope this helps. PERFECT!! That's exactly what I needed!

Thank you very MUCH Sidewinder

katsu



Discussion

No Comment Found