≡ Menu
Batch file

Batch Files are very useful because they can be used to copy a lot of files with a click of a mouse. All you have to do is write the batch file and run it. You need to know MS-Dos/command prompt commands to make batch files work since batch files use MS-DOS as it main instructional language.

You use Notepad or any other Text editor and save the file with a .bat extension, you need to save as type to “All File *.*”

Save batch files as .Bat

1. Start more then one file or program with a click of a mouse.

@ECHO OFF
Start ” ” “Paste file path to file in between the quotes”
Start ” ” “C:\Users\johnson\Desktop\listen.pls”

2. Copy all files and folder in a folder called Stuff on drive C:\ to U:\ and verify the files copied correctly.

U:
md stuff
cd stuff
xCOPY /e /v C:\stuff
pause

3. Run IPconfig /all

@echo off
c:\windows\system32\ipconfig.exe /all
@pause

4.Run NSlookup to find the NS IP of a website.

@echo off
c:\windows\system32\nslookup.exe
@pause

To edit a batch file you need to open it with Notepad or right click the batch files and pick edit.

Edit Batch File

You can make more batch files by typing more MS-DOS commands in your batch files. To Prevent your command prompt window from closing type pause to the end of your batch file.

Happy Batching!

4 comments… add one
  • JenniC January 13, 2010, 1:12 pm

    Nice article. Batch files are good. I have seen people often use biterscripting ( http://www.biterscripting.com ) coupled with batch files. It complements some of the missing functionality of batch – especially automatic parsing, cutting, extracting, etc.

  • Johnson Yip January 25, 2010, 10:53 pm

    Thanks for the suggestion, I check out biterscripting when I have the time!

  • Mike May 7, 2010, 9:37 am

    Batch files, although not pretty, are a great way to customize repetitive tasks. Couple them with the “Scheduled Tasks” manager for such things as backups, and time synchronizing, and you are rolling!
    .-= Mike´s last blog ..Send Email From A Batch File =-.

  • Johnson Yip May 7, 2010, 4:26 pm

    I agree Batch files are great for repetitive tasks to use with Task Scheduler. I’m also glad that software programmers these days program in auto-shutdown when a disk defrag or disk cleanup is done for software like CCleaner, and Auslogic disk defrag.

Leave a Comment