I am attempting to parse an output file for some data, and am having problems returning the value to my Windows shell.
What I am trying to do is simply return a value using a simple regular expression, and store that into my shell variable.
I currently have something like this:
%VAL% = %PERL% -e '$tmp="Value: 1000"; if ($tmp =~ /Value:\s(\d+)/) { print $1; }'
where %VAL% is where I’d like to return what was found in $1, and %PERL% points to a local copy of perl.exe.
Can somebody please point out the proper way of doing this?
EDIT: It’s a bit uglier than Unix:
Or use
set /pwith an intermediary file:From Silly Batch File Tricks