I'm trying to get the contents of a command run from CMD to write to a file but an not sure how to accomplish this... Right now I have:

Code:
Break On

$computer = @WKSTA
? $computer + @CRLF
shell "%comspec% /c java -fullversion"
sleep 2



I've tried setting the "Shell" command to a var as below:

Code:
Break On

$computer = @WKSTA
? $computer + @CRLF
$x = shell "%comspec% /c java -fullversion"
sleep 2



so that I can write the information to a file but I get an error. Can anyone tell me how to go about this or even if I'm in the right mode of thinking?