The syntax for using WORKSET.EXE is:
Where PID is the Process IDentifier, which can be seen on the Processes tab of Windows Task Manager, or from various command line tools.
Some applications allocate much more memory than they use. While Windows will eventually reclaim much of it, WORKSET.EXE will do it faster. A heavily used application, like Explorer.exe, may never reclaim the excess memory it acquires, but running WORKSET.EXE on the Explorer.exe PIDs will reclaim the memory.
If you wanted to reclaim memory on all the .exe processes on a Windows XP or Windows Server 2003 computer, run the following ReclaimEXE.bat script:
@echo off setlocal ENABLEDELAYEDEXPANSION for /f "Tokens=1* Delims=." %%a in ('tasklist^|Find /i "exe "') do ( set line=%%b set line=!line:~4,35! set line=!line: =! set line=!line:Console=! WORKSET.EXE !line! ) endlocal