Thank you for the reply Hackoo and sorry for the late response.
If I understand your code correctly, the top section is basically calling the bottom and resetting the "count" variable to 0 for every file...the bottom section is doing the actual counting of the commas (counting how many columns)? Is this correct?
Also, what does Line 5 - echo You should drag and drop a [".csv"] file over this script "%~nx0" mean? drag and drop a .csv file?
For what it's worth, right now my Before.csv file looks like this -
Col1,Col2,Col3,Col4,Col5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
,,,,
1,2,3,4,5
1,2,3,4,5
and with the code I have in my original post, the After.csv file looks like this -
Col1,Col2,Col3,Col4,Col5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
Which is perfect, but like I said, I want to count the number of columns on the fly, for as many .csv files as there may be in this folder at the time the batch file is run.
Kris