I am trying these commands in a .bat file
@echo off & setLocal EnableDelayedExpansion
powershell -NoLogo -NoProfile -Command ^
"$h = [int](Get-Date -Format "HH");" ^
"$diff = (7-$h)*3600;" ^
"if ($h -le 7 -or $h -ge 0) { ECHO $h; ECHO $diff; }"
But this throws an error saying command not recognized. Here I am trying to get the hour and subtract $h from 7. Then multiply the result with 3600 and print it on the console.
Can anyone tell me what am I doing wrong?