I am new to batch scripting, coming from a linux environment, and have to write a couple of simple scripts here at work. I work in a manufacturing plant and when a product passes a test it saves a test certificate onto the LAN. We have dozens of products, but management wants to be able to have a script running that at any given point in the day we can see how many of each product has been built. My approach to this is navigating to where these test certificates are saved and seeing which ones were modified today.
So the following script works for almost all of the products, but or some reason on two of them it doesn't write the count to the file that I specified.
@echo off
setlocal
set count=0
cd /D T:/"Product Name"/"Test Certificates"
for /f %%i in ('forfiles -m *.txt -d 0 /c "cmd /c echo @FILE"') do @call set /a count+=1
echo %count%>J:\units_built\currently_built_productA.txt
endlocal
I tried taking the write command out to see if the count variable was being set and it is. So for some reason the write isn't working. It is creating an empty text file even though count is an integer... I have the exact same code working in various other examples but for some reason two won't. Please help! Thank you