Running a batchfile with the following entry gives an error. SET CTIME = %TIME:~0,2%
rem **this sets the variable ctime to the hour portion of the time, example 17 or 23IF %CTIME% = 13
= was unexpected at this time.Any idea?
W. Vanpeel

Hi
You need two equal signs.
IF %CTIME%==13
Hi,
thx, but still the same error.
I tried
IF %CTIME%==13
IF %CTIME==13
IF %CTIME=13All give the same error or syntax error.
CTIME variable is OK
SET command lists also CTIME=13Rgds
W. Vanpeel
Hi
That should work, you could try
if %ctime% EQU 13
but what is code doing with the if statement.
For some reason, this will not run correctly with spaces before or after the "=". This seems to run OK:
SET CTIME=%TIME:~0,2%
IF %CTIME%=="13" ECHO MATCH!!
IF NOT %CTIME%=="13" ECHO NO MATCH!!
Rule #1 Good computers don't go down.
Rule #2 There is no such thing as a good computer.
This works, good stuff.
Thx RickW. Vanpeel
