You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser.
if-verschachtelung
About this tag
The tag if-verschachtelung covers nested IF statements in Windows batch scripting, as shown in a forum thread where a user struggles with a batch script that calculates time differences. The script uses IF GTR and IF GEQ conditions inside a parent IF block, but the inner IF fails to execute. Discussions focus on debugging nested IF logic, variable expansion with enabledelayedexpansion, and correct syntax for arithmetic comparisons in batch files. Common pitfalls include missing parentheses, improper variable handling, and delayed expansion issues. This tag is relevant for Windows system administrators and developers writing complex batch scripts with conditional branching.
Ich habe folgendes Batch-Skript geschrieben:
Setlocal enabledelayedexpansion
Set /A h1 = 12
Set /A m1 = 10
Set /A h2 = 14
Set /A m2 = 50
If %h2% GTR %h1% (
Set /A h = %h2% - %h1% -1
Set /A m = 60 - %m1% + %m2%
If "%m%" GEQ 60 (
Set /A m = %m% - 60
Set /A h = %h% + 1...