Assign command result to a variable

for /f "tokens=*" %%a in ('"WHERE notepad.exe"') do set YOURVAR=%%a
echo.%YOURVAR%