Batch file ‘for’ loops – multiple lines
It is because everything between the parentheses is loaded as one line. So %FileName% is expanded (at load time) before it is set (at run time). If you need to use the second format, you need to enable delayed expansion. Then you will have difficulty if the filename contains a !. This would work if … Read more