0

Can you help me please, I would like to create batch for count number of file start with key word "MM_" in this path.

D:\>dir /o | find "MM_"
27/06/2017  01:14 PM             1,592 MM_170613.csv
27/06/2017  01:14 PM             1,376 MM_170614.csv
27/06/2017  01:13 PM             2,223 MM_170615.csv
27/06/2017  01:12 PM             2,241 MM_170616.csv
27/06/2017  01:11 PM             2,497 MM_170617.csv

I have use command as Stephan provide as follow detail

@ECHO OFF C: cd "C:\MyDir" set cntAAA = dir /b *MM_*|find /c /v "" echo %cntAAA%

Result is show

0 echo off

Somebody can help?

3
  • 1
    find /? states a /c parameter to count... dir /b *MM_*|find /c /v "" Commented Jun 27, 2017 at 9:20
  • You need for /F to capture the output of a command (line)... Commented Jun 27, 2017 at 11:57
  • 1
    Possible duplicate of Capture output command CMD Commented Jun 27, 2017 at 11:58

1 Answer 1

0

Try this instead:

@Echo Off
CD /D "C:\MyDir"
Set "cntAAA=Dir/B "MM_*.csv"|Find /C /V """ 
%cntAAA%
Pause
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.