- One-Liners
- Split a command onto multiple lines
- Ask a question and then act upon the response
- Calling another executable from within a batch script
Good Practice
Always reference the full path name to any executable.
Use %SystemDrive% instead of C:\.
Use %SystemRoot% when you have to refer to the Windows directory, not %SystemDrive%\Windows - this will help on Windows 2000 and NT which use, eg, C:\WinNT instead.
Loops
- The Power of For - For's job is to automatically select a set of files or folders based on a criterion that you specify, then to execute a given command repeatedly—once for each file
- Forfiles - an alternative to the For command that makes it easy to select files by modified date or filesize (included in Vista, available in other Windows OS via the Resource Kit)
