Defragment SQLite databases used by Firefox/Win32 and other software.

for /f "delims==" %a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;|"sqlite3.exe" "%a"
This command defragment the SQLite databases found in the home folder of the current Windows user. This is usefull to speed up Firefox startup. The executable sqlite3.exe must be located in PATH or in the current folder. In a script use: for /f "delims==" %%a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;|"sqlite3.exe" "%%a"
Sample Output
C:\>for /F "delims==" %a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;  | "sqlite3.exe"  "%a"

C:\>echo vacuum;  | "sqlite3.exe"  "C:\Documents and Settings\vutcovici\Application Data\Mozilla\Firefox\Profiles\3apduvcu.default\content-prefs.sqlite"

By: vutcovici
2010-01-18 20:56:00

What Others Think

The for command in the NT command prompt is very flexible. It almost makes up for how shitty the rest of it is (variable handling in command scripts makes me want to stab myself with a screwdriver). If you write command scripts on Windows computers and you're not familiar with for you really should read through the help text.
andrew112358 · 627 weeks and 1 day ago
Do you have a better alternative?
vutcovici · 627 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: