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.
setlocal
About this tag
The setlocal command is used in Windows batch scripting to localize environment variable changes, ensuring they do not affect the calling process. In the context of Windows batch files, setlocal enabledelayedexpansion allows variables to be expanded at execution time rather than parse time, which is essential for handling variables within loops and conditional blocks. The tagged content discusses a batch script that uses setlocal enabledelayedexpansion to calculate time differences, highlighting common issues with nested if statements and variable expansion. Users troubleshooting similar problems can find discussions on proper syntax, variable scoping, and delayed expansion behavior when using setlocal in batch scripts.
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...