Lately I've been doing a fair bit of scripting. I made several scripts for the Overseas Fair in order to make my life easier, when doing repetitive tasks such as, clearing Mozilla update Cache out and modifying C:\WINDOWS\system32\drivers\etc\hosts. Sure these aren't very challenging tasks by any means, actually most only require a few clicks and to type a few lines of code, but this can get very annoying if done over and over and over.
At work I've made scripts for app deployment, backup, checking logs, synchronizing files, pinging computers, and scheduling automated tasks such as Spybot to run once a week. One of the easiest ways to make these scripts general and not have to hard-code in many different cases is to use environment variables.
I've compiled a short list of environment variables that work with Windows XP, and I assume that most of these will work with Vista as well, but have not yet tested them out.
%APPDATA% - Returns the current user's Application Data folder path. This is really useful if you simply want to navigate to the current users "Application Data" folder, without having to turn on "show hidden files and folders."
%USERPROFILE% - Returns the current user's home directory path. Again incredibly helpful for scripting and/or simply navigating around. Use this in conjunction with the "Windows Logo + R" tip and type "%USERPROFILE%" to quickly open the home directory in a windows explorer window.
%COMPUTERNAME% - This one is pretty explanatory, but it returns the computer's name. This is extremely helpful when creating special case scripts that you only want running on a certain list of computers. You can implement IF-statements, to add logic to the scripts.
%USERNAME% - Returns the current username that is logged in. Just like the %COMPUTERNAME% variable, the username variable comes in good use when making special cases to allow scripts to run only if a particular user or users are logged in.
%DATE% - Returns the current Date (example of output: Tue 02/05/2008).
%TIME% - Returns the current Time (in 24 hour format).
%HOMEDRIVE% - Returns the Driver letter that the current logged in user's home directory resides on. (in most cases this will be C:).
%WINDIR% - Returns the location of the WINDOWS directory (such as C:\WINDOWS). These last two are great for making sure your scripts are generalized and not so specific, that they don't function correctly if thrown into an environment where the WINDOWS drive is actually D: or E: and so on.
Most of these I knew from previous scripting and Windows XP experience, but a few I just found out about thanks to this post.
Hopefully some of these you didn't know and hopefully you can put these to good use sometime.