Saturday, January 23, 2016

First steps to write batch files in windows



I'm sure that nearly every windows user have seen files with extension .bat . What are the they, What do they do, How can we make them.

They are actually one type of files that exist in windows operating system and those files can be used to get some work done by OS.

Lets see how we can create those files with simple example.

@echo off
title My First Batch File
echo Hello!
pause


  • Don't worry about the first line @echo off (If you want check out more details from here)
  • title My First Batch File this line gives a title to our batch file
  • echo Hello! line print the word "hello!"
  • pause this will pause the program for user inputs
Now save this file with any name you want with .bat extension and double click on the created batch file to execute what you programmed.

Note:Make sure when you save set Save as type to "All types".


No comments:

Post a Comment

Optimize you working enviorenment : Single command to create & move to a directory in linux (C Shell, Bash)

Usually move to a directory just after creating is bit of a anxious task specially if the directory name is too long. mkdir long-name-of...