Skip navigation

JSI Tip 9953. How can I output, in CSV format, the offline cache settings for my Windows XP shares using information from the registry?

In tip 9936, we generated a CSV format output of the offline cache settings for Windows workstation and Windows Server shares, using the net share command.

I have scripted OLCREG.BAT to output the offline cache settings for a Windows XP workstation, using information from the registry.

When you type OLCREG in a CMD.EXE window, the output is displayed on the console in the following format:

"Share Name","File System Path","Cache Setting"

Where Cache Setting can be one of the following:

Manual caching of documents
Automatic caching of documents
Automatic caching of programs and documents
Caching disabled.
OLCREG.BAT contains:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set qry=reg QUERY "HKLM\System\CurrentControlSet\Services\Lanmanserver\Shares"
set fnd=find "REG_MULTI_SZ"
for /f "Tokens=1,2*" %%a in ('%qry%^|%fnd%') do (
 set line=%%c
 set line=!line:\0=#!
 for /f "Tokens=2,6 Delims=#=," %%i in ('@echo !line!') do (
  call :out "%%a" "%%i" "%%j"
 )
)
endlocal
goto :EOF
:out
if %2 EQU "0" set cc="Manual caching of documents"&goto out1
if %2 EQU "16" set cc="Automatic caching of documents"&goto out1
if %2 EQU "32" set cc="Automatic caching of programs and documents"&goto out1
if %2 EQU "48" set cc="Caching disabled"
:out1
@echo %1,%3,%cc%



Hide comments

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.
Publish