I'm trying to set the output of a commandline program to a variable in a Windows batch file. For example, if I'd like to read the output of the "ver" command (which tells you what version of window) to a variable called "myvar", how would I do it?
So "ver" outputs for me:
"Microsoft Windows XP [Version 5.1.2600]"
How would I read that into a variable called myvar?
I tried piping it, but can't figure out what the syntax would be.
This is trivial in other languages such as PHP, where I'd simply have:
$myvar = shell_exec("ver");
Anyway, any help greatly appreciated.
So "ver" outputs for me:
"Microsoft Windows XP [Version 5.1.2600]"
How would I read that into a variable called myvar?
I tried piping it, but can't figure out what the syntax would be.
This is trivial in other languages such as PHP, where I'd simply have:
$myvar = shell_exec("ver");
Anyway, any help greatly appreciated.