Is there an easier and more logical way to make continuous if - else statements in batch than the one that I am using nowadays. I'm very new to programming etc. and first I tried to make a code like this:
if %time:~0,2% geq 8 (
if %time:~0,2% leq 9 (
start "" "C:\users\me\desktop\subject1.bat"
) else (
if %time:~0,2% leq 10 (
start "" "C:\users\me\desktop\subject2.bat"
) else (
if %time:~0,2% leq 11 (
start "" "C:\users\me\desktop\subject3.bat"
)
) else (
Exit
)
Now the idea is that if time isn't over 8 it simply closes the program. But if it is over 8 then it goes and checks if time is less than 9 -> open subject1, less than 10 -> subject2 etc. But the code didn't work on the second else so I started to use this mainly because it works:
if %time:~0,2% geq 8 (
goto :check1
) else (
Exit
)
:check1 (
if %time:~0,2% leq 9 (
start "" "C:\users\me\desktop\subject1.bat"
) else (
goto :check2
)
)
:check2 (
if %time:~0,2% leq 10 (
start "" "C:\users\me\desktop\subject2.bat"
) else (
goto :check3
)
)
:check3 (
if %time:~0,2% leq 11 (
start "" "C:\users\me\desktop\subject3.bat"
)
)
The second way works but it looks bad and is hard to read even to me. Is there a more simple way to do this? The reason why I made this code is because my laptop is kinda slow to boot (SSHD hybrid drive instead of SSD) so I compensate the lost time by automatically run on boot (done) and connecting to wifi (also done) and opening the needed softwares and websites.