I have the command below to count all directories that that follow the pattern 20?????? :
\'dir /b \"20??????\" | find /c \"2\"\'
This is my code:
@echo off
set com=echo HI
::Start Of Code You Need
echo|%com%>>"%temp%\tmp.txt"
for /f "tokens=* delims=" %%x in (%temp%\tmp.txt) do (
set output=%%x
)
del /q %temp%\tmp.txt
::End Of Code You Need
echo This Is The Output:
echo %output%
pause>NUL
It takes the input from com and outputs from output