I tried the bat file (without checking the details) and it seems to work fine for me. I noticed that it closes instantly if you do not add the path to the file with quotes - for example. "file". Example:
Name of the file: path\file.txt
This hopefully solves your problem.
As for your question in EDIT , a simple option is to iterate over the list of files and execute a package on each of them.
batch1.bat: (% 1 refers to the first command line parameter)
@echo off setlocal enabledelayedexpansion echo %1 set atname=%1 for %%i in ("%atname%") do set attribs=%%~ai set attrib1=!attribs:~0,1! set attrib2=!attribs:~1,1! set attrib3=!attribs:~2,1! set attrib4=!attribs:~3,1! set attrib5=!attribs:~4,1! set attrib6=!attribs:~5,1! set attrib7=!attribs:~6,1! set attrib8=!attribs:~7,1! set attrib9=!attribs:~8,1! cls if %attrib1% equ d echo Directory if %attrib2% equ r echo Read Only if %attrib3% equ a echo Archived if %attrib4% equ h echo Hidden if %attrib5% equ s echo System File if %attrib6% equ c echo Compressed File if %attrib7% equ o echo Offline File if %attrib8% equ t echo Temporary File if %attrib9% equ l echo Reparse point echo. echo.
Then create a list of all files in the specified path (for example, "folder", including all subfolders):
dir /s /b folder > ListOfFiles.txt
main.bat (read ListOfFiles.txt each time and pass each line to batch1.bat as a command line parameter):
@echo off for /f "tokens=*" %%l in (ListOfFiles.txt) do (batch1.bat %%l)
Then from cmd:
main.bat >> output.txt
The last step generates an output file with full results. Of course, this can be done in a more polished (and probably shorter) way, but this is one obvious direction you could take.
source share