Get a PowerShell result into a CMD variable 6. October 2020 sellout Windows (0) put this in your batch file: @echo off For /F %%t In ('PowerShell -command " (Get-Date).AddHours(-1).ToString('yyyy-MM-dd-HH') "') Do Set "FN=%%~t" echo %FN%