The following commnad:
$sun=PowerShell [DateTime]::Today.AddDays(-8).ToString(\'dd-MMM-yyyy\') echo %sun %
the output of the echo is
You need to use for /f:
for /f
for /f "usebackq" %%x in (`powershell "(Get-Date).AddDays(-8).ToString('dd-MMM-yyyy')"`) do set sun=%%x