DIR command: how to concat file listing?
@echo off
:: First parameter is the folder to dir
if {%1}=={} @echo Syntax: FolderList FolderPath&goto :EOF
if not exist %1 @echo FolderList %1 - %1 not found&goto :EOF
setlocal ENABLEDELAYEDEXPANSION
pushd %1
set LIST=
for /f "Tokens=*" %%a in ('dir /b /a-d') do (
if "!LIST!" NEQ "" set LIST=!LIST!,
set LIST=!LIST!%%a
)
@echo %LIST%
endlocal
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
|