*Note: The batch scripts below were created for Windows XP.
Many people will usually end up using one computer to handle most everything, so you can imagine how much software gets installed and how sluggish it can get. With everything that starts automatically my laptop easily pushes 800MB of RAM usage after startup.
Many processes that are enabled by default are not used all the time; in fact I rarely use many of the ones on my laptop. One way to trim down the load on a computer without having to completely remove software is to setup scripts to manually start/stop processes as needed.
Step 1: Identify categories to group rarely used processes under
Categories for my computer:
- IIS, ASP.NET development
- PHP, apache development
- Cold fusion development
- Proxy services (Tor/Privoxy)
Step 2: Find executables and processes that are started automatically for each category
This step is a bit of trial and error; focus on a few at a time because finding dependencies for a large number of processes would not be fun.
-Set each relevant service to “Manual” startup.
-Remove each relevant executable from automatically starting up.
Step 3: Create a batch script for each category
Place commands to start/stop each process and executable from step 2 into a batch file.
The following are provided as an example, they may need modification for other installs.
IIS.bat:
@echo off
set x="%1"
set y="%2"
IF %x%=="start" (
net start "SQL Server (SQLEXPRESS)"
net start "SQL Server Browser"
net start "SQL Server FullText Search (SQLEXPRESS)"
net start "SQL Server VSS Writer"
net start "Simple Mail Transfer Protocol (SMTP)"
net start "World Wide Web Publishing"
net start "IIS Admin"
net start ".NET Runtime Optimization Service v2.0.50727_X86"
) ELSE IF %x%=="stop" (
net stop "SQL Server (SQLEXPRESS)"
net stop "SQL Server Browser"
net stop "SQL Server FullText Search (SQLEXPRESS)"
net stop "SQL Server VSS Writer"
net stop "Simple Mail Transfer Protocol (SMTP)"
net stop "World Wide Web Publishing"
net stop "IIS Admin"
net stop ".NET Runtime Optimization Service v2.0.50727_X86"
) ELSE (
echo Valid Options:
echo start
echo stop
);
IF %y%=="nopause" (
echo Done with apache.bat
) ELSE (
pause
)
apache.bat:
@echo off
set x="%1"
set y="%2"
IF %x%=="start" (
start "httpd" httpd.exe
start "ApacheMonitor" /Dc:\"Program Files"\"Apache Software Foundation"\Apache2.2\bin /B ApacheMonitor.exe
net start "mysql"
) ELSE IF %x%=="stop" (
tskill ApacheMonitor
tskill httpd
net stop "mysql"
) ELSE (
echo Valid Options:
echo start
echo stop
);
IF %y%=="nopause" (
echo Done with apache.bat
) ELSE (
pause
)
cf.bat:
@echo off
set x="%1"
set y="%2"
IF %x%=="start" (
net start "ColdFusion 8 .NET Service"
net start "ColdFusion 8 Application Server"
net start "ColdFusion 8 ODBC Agent"
net start "ColdFusion 8 ODBC Server"
) ELSE IF %x%=="stop" (
net stop "ColdFusion 8 .NET Service"
net stop "ColdFusion 8 Application Server"
net stop "ColdFusion 8 ODBC Agent"
net stop "ColdFusion 8 ODBC Server"
) ELSE (
echo Valid Options:
echo start
echo stop
);
IF %y%=="nopause" (
echo Done with coldfusion
) ELSE (
pause
)
tor.bat:
@echo off
set x="%1"
set y="%2"
IF %x%=="start" (
start "vidalia" /Dc:\"Program Files"\vidalia /B vidalia.exe
start "privoxy" /Dc:\"Program Files"\privoxy /B privoxy.exe
start "pg2" /Dc:\"Program Files"\PeerGuardian2 /B pg2.exe
) ELSE IF %x%=="stop" (
tskill privoxy
tskill vidalia
tskill tor
tskill pg2
) ELSE (
echo Valid Options:
echo start
echo stop
);
IF %y%=="nopause" (
echo Done with apache.bat
) ELSE (
pause
)
Step 4: Create scripts to start and stop all at once
Add a reference to each of the above batch files into a master batch that can be used for starting/stopping all at once.
startall.bat:
@echo off
start /B apache start nopause
start /B tor start nopause
start /B iis start nopause
start /B cf start nopause
pause
killall.bat:
@echo off
start /B apache stop nopause
start /B tor stop nopause
start /B iis stop nopause
start /B cf stop nopause
pause
Place these batch files into a folder that is within your PATH so they can be executed using Start->Run. I prefer keeping these and other random command tools in a central location that has been added to my PATH variable.
C:\cmdtools
Start->Run commands to START services:
iis start
apache start
cf start
tor start
startall
Start->Run commands to STOP services:
iis stop
apache stop
cf stop
tor stop
killall
The difference is quite dramatic on my laptop; RAM usage drops 418MB, with 19 fewer processes running at startup.