What is the difference between a batch file and a script in Windows?


  • Also What are some good beginning books or resources that I can learn how to write and create batch files and scripts? Preferably like guides that can guide me through different exercises or creativity of them? If you cant find guides just any resource would be find.  I am asking this becasue I know that they are good tools to create a multiple task into one click and I would like to use them. If anybody has any information I would greatly appreciate it.
    Sunday, April 22, 2012 4:52 AM


  • JRV's reply gave you an excellent reference for PowerShell and VB Scripts. Both of these are proper programming languages whereas batch files are basically a collection of console commands. Instead of typing the same commands repeatedly, you place them into a batch file and run that file "as a batch of commands", hence the name.

    For simple tasks such as copying or deleting files or performing a recursive file search, batch files are very easy to write. If you know a console command and its syntax then you can put it into a batch file. They also run very fast when performing such tasks. Here is an example:

    @echo off
    xcopy  /s /d /y "d:\My Pictures"  "W:\My Pictures\"
    dir c:\*.jpg /s

    For advanced tasks, batch files can become extremely cryptic in their syntax or they lack the robustness you may require. They also lack many functions that programmers tend to take for granted such as date arithmetic or text file editing.

    Sunday, April 22, 2012 10:33 AM

All replies