How to store the result of a command expression in a variable using bat scripts?

前端 未结 5 1987
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 23:10

I have the command below to count all directories that that follow the pattern 20?????? :

\'dir /b \"20??????\" | find /c \"2\"\'
5条回答
  •  盖世英雄少女心
    2020-12-03 00:04

    Here's a sample:

    @echo off
    set wildcard=C:\*.*
    set count=0
    FOR /F %%a in ('DIR /B %wildcard%') do set /A count=count+1
    echo %count% files matching %wildcard%
    set choice=
    set /p choice=Press enter to continue ...
    

提交回复
热议问题