Quantcast
Channel: Tom Carpenter's Blog » windows 7
Viewing all articles
Browse latest Browse all 10

Windows 7 Batch Files – More of the Same

$
0
0

With every new release of Windows, the rumors start. "Windows 7 will destroy the command prompt," or "the command prompt will die in the next version of Windows." Of course, these rumors have never been true in the past and they are not true now. Windows 7 batch files work in the same basic way as batch files worked in Windows Vista, Windows XP and every NT-based system all the way back to Windows NT 3.1. Windows 7 batch files provide more of the same, but this is a good thing. You can use batch files for many tasks, including:

  • Information gathering
  • System configuration
  • Automation of administration
  • Simplification of redundant and mundane tasks
  • Just about anything else you can think of

 

Unlike the rumors, the truth is that Windows 7 batch files are more powerful than ever thanks to the introduction of new command line tools or commands in Windows 7. Here's just a sampling of the new tools that are included in Windows 7's command prompt:

  • PowerCfg - for power management configuration from the command prompt.
  • BCDEdit - OK, not new for 7, but who used Vista? This command is used to edit the boot configuration database.
  • TZUtil - for setting the timezone from the Windows 7 command prompt.
  • Defrag - a command line utility for full volume defragmentation (I still prefer CONTIG and Defraggler, but that's just me).

 

Additional tools were added or enhanced in the Windows 7 command prompt and are useful from within batch files. Traditional tools prove useful as well. For example, consider the following potential Windows 7 batch file:

@echo off
tasklist /FI "MEMUSAGE gt %1"

If you save the preceding text in a file named tbmem.bat, you can then run it as:

tbmem 10240

This command will then list any running processes using more than 10 MB (10240 KB) of memory. Instead of typing the full tasklist command, you can simply type the shortened batch file command. Windows 7 batch files can further shorten even more complex processes. I'm continually creating batch files that contain more than 20 lines. Now, if the exact same work were done outside of the batch file, I may be able to do it in less than 10 commands, but the batch files sure save me time over time.

This little post may get the gears turning again for some old timers (like myself) who used batch files in the good old DOS days and it may give some ideas to some GUI masters of the modern era. Either way, you should definitely take a fresh look at Windows 7 batch files to see where you can automate or improve your day-to-day work with the operating system.


Viewing all articles
Browse latest Browse all 10

Trending Articles