Batch file magic

Dave Farquhar has back-to-back posts on batch files.

How to clear your print queue from the command line or a batch file

Here’s an old, old, but still useful tip that works on all NT-based versions of Windows (including XP and 7). Longtime reader Jim couldn’t find it here anymore, and I can’t either, so I’ll repost it for posterity.

Open a command prompt, and issue these three commands:

net stop spooler

del /q c:\windows\system32\spool\printers\*

net start spooler


Doing more than one operation per line in a Windows batch file

Sometimes in a batch file I find myself needing to perform more than one operation on a server, especially inside a for loop. Rather than do a pair of for loops, which isn’t always desirable, you can use the & operator.