@echo off SET FILECOUNT=0 FOR /F "usebackq" %%a in ( `powershell "(Get-ChildItem D:\users\metan\downloads\ -File).Count" ` ) DO SET FILECOUNT=%%a ECHO FILECOUNT=%FILECOUNT%