Backing Up the Removable Storage Database In Windows XP


This batch program creates a backup copy of the Removable Storage database. It illustrates some commonly used techniques, including stopping and starting services and using environment variables.

The following program is called Rsbackup.bat:

@echo off
rem Backs up the Removable Storage database
title Removable Storage Backup
echo Removable Storage database backup in process...

echo Stopping the Removable Storage service
net stop "removable storage" > nul

echo Copying the Removable Storage database
xcopy /y %systemroot%\system32\ntmsdata %systemroot%\system32\ntmsdata
\backup\ > nul

echo Starting the Removable Storage service
net start "removable storage" > nul

echo.
echo Removable Storage database was backed up to
echo %SystemRoot%\System32\NtmsData\Backup\
title Command Prompt


The first command to examine is Net Stop:

net stop "removable storage" > nul

The Net command is frequently included in batch programs because it can be used to control so many functions in Windows. In this case, we are stopping the Removable Storage service to ensure that it doesn’t have the database files open when we try to copy them. To stop or start a service, you can use the service’s “friendly name” (that is, the name that appears in the Services snap-in), as we’ve done here, or you can use the actual service name if you know it. (In the case of Removable Storage, the service name is Ntmssvc.) Throughout the program, Echo statements keep the user informed of the progress. Therefore, we use > Nul to redirect the output of the Net statement to the Nul device—colloquially known as the “bit bucket”— because its output is redundant.

The Xcopy command then makes a copy of the files:

xcopy /y %systemroot%\system32\ntmsdata systemroot%\system32\ntmsdata\

backup\ > nul


On mainly computers, the Removable Storage database files are stored in C:\Windows\ System32\Ntmsdata. Though, if you installed Windows in a different folder, the files will be in a different location. In this Xcopy statement, %SystemRoot% is an environment variable that states where Windows is installed on the local computer. By using environment variables, be sure that your batch programs work on any computer that is running Windows XP.