I'm trying to make a batch file that'll run in the background and shut my computer off when the regional time corresponds to a time I've set so that I can fix my sleep schedule.

However, I'm running into issues testing how to compare the current time to the time I've set as a variable.

I believe that it's due to the format that is returned by the time command and the format I entered not being the same.

I would like to enter a time in the 12-hour format and the computer shuts down at the designated time. But the time command returns a 24-hour format string unless paired with the /t switch.

This is what I currently have as test code that returns a printed line instead of shutting down my computer:

@echo off

set /p shutdownTime=What time would you like to shut down the computer?

:begin
set time=time /t
if "%time%" EQU "%shutdowmTime%" echo Time Confirmed
goto begin

I know that instead of an if statement in a loop I could probably do a for or while loop, but I'm honestly trying to keep it as simple as I can for my nocturnal smooth brain that woke up about 3 hours ago.

Any help is appreciated. Thank you.