Oh and I just remembered some other handy batch files I made.
When I used to use Hamachi (a VPN program), Vista sometimes would connect to my emulated Hamachi network card by default instead of my ethernet card and my internet wouldn't work until I went into devmgmt.msc and disabled Hamachi.
I solved this by making a batch file (hamachi.bat) to use devcon.exe to tell me of the status of my Hamachi network driver, and then give me the options to disable it, enable, start hamachi, or exit. Note: This script needs devcon.exe (from Microsoft) and grep.exe to run. grep is a very popular Unix command written to search for text in stdout and return any lines matching that text. Along that, you could specify flags, such as to invert the search, or be case insensitive. Since Windows doesn't have anything equivalent to it, I just download the Linux version compiled for Windows. It's commonly piped (|) from other commands and acts as a filter.
The second batch file gets rid of Windows' cache of all the updates you download (the installation files). I guess you should only use this if you want to free up some space. Note: it removes the history of the update being installed when you look at previously installed updates in Windows Update.
And here's a list I copied from some other website that I've found useful, basically it's variables that you can use in your batch files which can save you time and make your batch files more portable.
Code:
%ALLUSERSPROFILE% C:\Documents and Settings\All Users
%APPDATA% C:\Documents and Settings\{username}\Application Data
%COMPUTERNAME% {computername}
%COMSPEC% C:\Windows\System32\cmd.exe
%HOMEDRIVE% C:
%HOMEPATH% \Documents and Settings\{username}
%PATH% C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem
%PATHEXT% .COM; .EXE; .BAT; .CMD; .VBS; .VBE; .JS ; .WSF; .WSH
%PROGRAMFILES% Directory containing program files, usually C:\Program Files
%PROMPT% Code for current command prompt format. Code is usually $P$G
%SYSTEMDRIVE% The drive containing the Windows XP root directory, usually C:
%SYSTEMROOT% The Windows XP root directory, usually C:\Windows
%TEMP% and %TMP% C:\DOCUME~1\{username}\LOCALS~1\Temp
%USERNAME% {username}
%USERPROFILE% C:\Documents and Settings\{username}
%WINDIR% C:\Windows
%DATE% Current date in the format determined by the Date command
%TIME% Current time in the format determined by the Time command
%CD% Current directory with its full path
%ERRORLEVEL% Number defining exit status of a previous command or program
%RANDOM% Random number between 0 and 32767
To try them out, you could open up cmd and type 'echo %date%' or 'echo %userprofile%'.
Oh and if you think you'll be writing more batch scripts in time, I highly recommend downloading
Notepad++ (I've linked the latest version from their SourceForge page). It has syntax highlighting for lots of popular programming and scripting languages, like batch, and it makes working with them a lot easier. And it's not much of a RAM-hog; I pretty much use it as a Notepad replacement.