Batch file programming tutorials

Batch Files : Get users default printer via registry (WinXP)

contributed by Jimmy Selix on August 18, 2007 under Batch file programming

This is another quickie recipe for you admins. This recipe shows how to get the current user’s default printer via the registry and output the information to a text file via a batch file and in turn combine the result files into a larger file to then import into excel.

 

XP Batch Files: Copy images from camera to pc and organize by date

contributed by Jimmy Selix on December 25, 2006 under Batch file programming

This is a quickie recipe on how to create a batch file that will copy all of your photos/videos from a memory stick or camera onto your pc’s my pictures folder (c:\documents and settings\userid\my documents\my pictures). this batch file will show you how to setup a prompt and using a basic if/then statement.

 

XP batch files: Create variable for current user account and find current user

contributed by Jimmy Selix on December 7, 2006 under Batch file programming

this is a quick batch file recipe that is more of an appetizer than a full meal. this recipe is just a quick batch file that lets you find the user who is currently logged in when the batch file is ran by using a FOR statement and the %USERPROFILE% variable in XP.

 

Batch File Converting of Video Files: SageTV example

contributed by Jimmy Selix on April 8, 2006 under Batch file programming

Well, i used to run SageTV as my PVR frontend but have later decided to switch to MCE2005 due to its cleanness and integration into XP. Anywho, in that time i found a For statement batch file i used to create my own script to autoencode video. After playing with For statements so long, i realized that it could be used for so much more!!

 

Date Calculation In Batch Files XP/2000

contributed by dtech10 on November 21, 2005 under Batch file programming

 

Using variables in Windows batch files

contributed by Rex on August 29, 2004 under Batch file programming

Regardless of the scripting language, the use of variables can greatly enhance the functionality of a script. This recipe demonstrated basic use of variables in MS-DOS or Windows batch files.

 

Processing the contents of a text file using FOR loop

contributed by gmartin on February 5, 2004 under Batch file programming

As admins, we often have to take actions against a list of things (computers, servers, file shares, etc). One great way to approach this is to put the list in a test file and use a FOR command to loop through the file and take a action against the contents.

 

Supress Responses From Commands In Batch Files

contributed by AlexTheBeast on December 6, 2003 under Batch file programming

This quick recipe describes how to supress responses to commands within batch files.