If you want to target all versions of Windows, your best choice is writing a MS-DOS Batch file (.bat). Here's a good tutorial that I've used in the past.
If you are targeting modern versions of Windows (Windows XP SP2/2003/Vista/7) you should definitely take a look at Windows PowerShell, which is the new standard automation engine for the Windows platform.
PowerShell is a separate download for Windows XP SP2, Windows Server 2003 and Windows Vista, while it is included in Windows Server 2008 and Windows 7.
About Windows PowerShell
PowerShell is built on top of the .NET Framework and consists of a runtime environment, a scripting language and an interactive console.
Here are some of its key features that I find most valuable:
- All processing is done using CLR objects, instead of text as in traditional shells
- It is possible to interact directly with the classes in the .NET Framework
- It is possible to run commands written in any .NET language and distributed as DLLs (called Cmdlets)
- Great collection of built-in commands to accomplish most administrative tasks
- The scripting language's syntax is C-style (curly braces...)
- The runtime can be hosted inside any managed process as an ad-hoc automation engine
This isn't of course a complete list of all the features in PowerShell. If you are interested, I recommend you to look into it. Here is a good place to start.