Skip to Content
Mar 29, 2015 at 12:08 PM

.bat file result not giving correctly in data services


Hi ,

I am using .bat file to count the number of files in the folder. I want to capture the value of the number of files.

I have written small .bat file as shown below

@echo off

setlocal enableextensions

CD %1

set cnt=0

for %%A in (*) do set /a cnt+=1

echo File count = %cnt%


I have used this batch file in the script as shown below.

$COUNT =exec('D:\\test.bat', 'D:\\docs',8);


In the above $COUNT is varchar(255).

actually i have only 11 file sin the docs folder . But it is giving the 442 files.

If I run the same batch file in the windows cmd command I am getting the correct result.

Please let me know what will be issues?

I am unable figure out the issues for weird result when I am using DS.

Please help me in this issue.

Thanks & Regards,



pastedImage_0.png (18.2 kB)