question about dos batch files?
I have a batch file which looks at a text file and displays the highest and lowest number in that text file. The problem is it keeps giving the same values for lowest and highest number even after the text file is updated.I make the loop go back and change stuff in the text file and go back to the code to determine the new lowest and highest values but it still gives the original values despite the values having been changed in the text file. Im wondering if this has something to do with the setlocal command or delayed expansion command?How does that work? Why is the min and max values not getting updated?
The code itself would update stuff if it were a batch file on its own so that proves there's nothing wrong with the code itself but being part of a much bigger batch with lots of other functions this doesn't seem to be working
- ChrisLv 71 month ago
Just to be clear, I assume you are 1) changing the file 2) reading its contents 3) determining the min/max value, in that order?
Can you post your batch code somewhere so we can take a look? On pastebin.com maybe?
- Anonymous1 month ago
setlocal is local to the specific batch file it is run from. It can't be read from a subsequent batch file or the parent.