This page is edited from the 1cmdfaq.txt faq-file contained in
my tscmd.zip
command line interface (CLI) collection. That zipped file has much
additional material, including a number of detached .cmd script
files. It is recommended that you also get the zipped version as a
companion.
Please see "
The Description and
the Index page" for the conditions of usage and other such
information.
171} How do I get a list of all the PC's folders with the attributes indicated?
@echo off & setlocal enableextensions
for /f "tokens=* delims=" %%f in ('dir /a:d /b /s "C:\"') do attrib "%%~f"
endlocal & goto :EOF
A prohibitive amount of output may be produced. You might wish to take
on a suitable subset.
@echo off & setlocal enableextensions
set temp_=%temp%
if defined mytemp if exist "%mytemp%\" set temp_=%mytemp%
set output_=%temp_%\foldlist.tmp
for %%f in ("%output_%") do if exist %%f del %%f
for /f "tokens=* delims=" %%f in ('
dir /a:d /b /s "C:\Documents and Settings\Default User\My Documents"') do (
attrib "%%~f">>"%output_%")
more "%output_%"
for %%f in ("%output_%") do if exist %%f del %%f
endlocal & goto :EOF
A similar task. List with all the attributes the read-only folders on the PC.
@echo off & setlocal enableextensions
for /f "tokens=* delims=" %%f in ('
dir /a:r /b /s "C:\"') do (
if exist "%%~f\" attrib "%%~f")
endlocal & goto :EOF
The output might be something like
R C:\Program Files
HR C:\Documents and Settings\All Users\Application Data
R C:\Documents and Settings\All Users\Documents
R C:\Documents and Settings\All Users\Start Menu
R C:\Documents and Settings\All Users\Documents\My Music
R C:\Documents and Settings\All Users\Documents\My Pictures
R C:\Documents and Settings\All Users\Documents\My Videos
R C:\Documents and Settings\All Users\Documents\My Music\Sample Music
:
R C:\WINDOWS\Web\Wallpaper
R C:\_M\Testing & more