JSI Tip 3247. Do you need to reset the Archive bit in Windows 2000?

If you have ever typed attrib -a /s *.* on your Windows 2000 platform, you know that a large number of objects may not be reset.

Try using ARSHBIT PATH where PATH is in the form of C:\*.* or "C:\Program Files\*.*".

ARSHBIT.BAT makes use of Windows 2000 delayed environment variable expansion, and the usebackq option of the FOR command.

ARSHBIT.BAT contains:

@echo off
REM Pagefile.sys and hiberfil.sys generate errors.
setlocal enabledelayedexpansion
if \{%1\}

\{\} goto syntax set drv=%1 set drv=%drv:"=% set wrk=%drv:\*.*=% if "%drv%"

"%wrk%" goto syntax if not exist "%drv%" goto syntax FOR /F "usebackq Tokens=*" %%i in (`attrib /s "%drv%"`) DO call :other "%%i" FOR /F "usebackq Tokens=*" %%m in (`dir /AD /b /s "%drv%"`) DO call :fldr "%%m" endlocal goto end :fldr set foldr=%1 FOR /F "usebackq Tokens=*" %%i in (`attrib %foldr%`) DO call :other "%%i" goto end :syntax @echo Syntax ARSHBIT PATH (ARSHBIT C:\** or ARSHBIT "C:\Program Files\*.*" endlocal goto end :other set line=%1 set bits=%line:~1,6% if not "%bits:~0,2%"

"A " goto end if "%bits:~0,2%"

" " goto end set bits=%bits:~3,3% set bits=%bits: =#% set line="%line:~12,256% set atr= for /f "usebackq" %%k in (`@echo "%bits:~0,1%"`) do call :setatr %%k for /f "usebackq" %%k in (`@echo "%bits:~1,1%"`) do call :setatr %%k for /f "usebackq" %%k in (`@echo "%bits:~2,1%"`) do call :setatr %%k attrib -A -R -H -S %line% attrib%atr% %line% goto end :setatr set wrk=%1 set wrk=%wrk:"=% If "%wrk%"=="#" goto end set atr=!atr! +%wrk% :end

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.