Set environment variable from stdout of command

#1
In a batch file, using sed to extract a string from a file (sed writes its output to stdout), I would like to set an environment variable to that extracted string. Is that possible?

Eg. from a Windows scheduled task xml file, which contains the line:

<spaces><Author>Papa\burger</Author><nl>

using the sed command:

sed -n -e"s/^.*<Author>\([a-zA-Z0-9_]*\)\\[a-zA-Z0-9_]*<\/Author>$/\1/ip" filename.xml

produces the output:

Papa<nl>

How to set environmentvariable=Papa?
 
#3
In a batch file, using sed to extract a string from a file (sed writes its output to stdout), I would like to set an environment variable to that extracted string. Is that possible?

Eg. from a Windows scheduled task xml file, which contains the line:

<spaces><Author>Papa\burger</Author><nl>

using the sed command:

sed -n -e"s/^.*<Author>\([a-zA-Z0-9_]*\)\\[a-zA-Z0-9_]*<\/Author>$/\1/ip" filename.xml

produces the output:

Papa<nl>

How to set environmentvariable=Papa?
Code:
SET environmentvariable=%@execstr[sed -n -e"s/^.*<Author>\([a-zA-Z0-9_]*\)\\[a-zA-Z0-9_]*<\/Author>$/\1/ip" filename.xml]
 
#4
Thanks once again, Steve and Vince, for prompt and helpful replies. I had thought of using a temporary file, but that was as far as I got. But @execstr[] is perfect for the task, it does exactly what I needed (in fact, an example in the help file even shows using it to set an environment variable!).