DOS Command File Manipulation in a Folder

If you have a list of files in a folder or list of files and sub-folders in a folder the simple DOS command forfiles comes handy. This command along with its options helps in manipulating the information like applying creation, deletion, removal of directories etc in a single shot.
Lets see a simple example of deleting all the files that are one week old
forfiles /p /M *.* /D -7 /C "cmd /C del @PATH > test.log"
In the above command forfiles will group all the files in path specified by path option /p
/M is the search option *.* points to files of all types. Note that this will exclude folders
del command is the simple dos command that deletes files
Environment variables in Windows 7:
Environment variables in Windows 7 , system environment variables as they are popularly called are a set of variables that are useful in setting up the user's environment. They come in handy when used with logon scripts. We can make use of the command "env" in Linux and flavours of Linux to get the default environment variable values.
Default values of these system variables in Windows can be obtained by issuing the command - set in command prompt
Some common environment variables are as follows :
%UserName% - User Account Name. It is equivalent to Linux environment variable $USER
%HomeDrive% - Drive in which user's home directory is located. Say if the home directory is at A, we get A: as output
%HomePath% - Full path to users home directory. It is same as pwd in Linux
%Processor_Architecture% - Displays the architecture of the processor such as x86. In Linux uname command can be used to display such details (uname -i; uname -p depending upon if it is Solaris, Linux etc)
%SystemRoot% - OS base directory
%PATH%  - tells Current system path
%PATHEXT% - command line knows which files are executables and which are not