Hi friends,
Today i will show you how to create a simple Batch program.
A batch program is a text file which contain some set of commands which will be executed one by one when the file is clicked .
Now to create a batch program,all u need is a text editor such as "Notepad" and "command prompt".
"Notepad" is used to code the program and "command prompt" is used to execute the program.
To create a simple batch program which prints your name&Address follow the below steps:-
1).Open "Notepad" from start menu in the taskbar
Start->All Programs->Accessories->Notepad
2).Type the following commands one by one
@ECHO OFF
ECHO.
ECHO YOUR_NAME.
ECHO YOUR_ADDRESS.
(Here in place of YOUR_NAME type your actual name,otherwise You will not get the desired output
Simillarly,in place of YOUR_ADDRESS type your actual Address,use ECHO Command for
every new line).
Below code is an example for printing the name and address of a person named "Rohith":-
@ECHO OFF
ECHO.
ECHO Rohith.
ECHO S/O.Ramesh.
ECHO H.NO:-1-68.
ECHO Madhuranagar colony.
ECHO Hyderabad.
ECHO AndhraPradesh.
3).Save the file using (.bat) Extension
Eg:-My_Address.bat
4).Below the file name path,there will be another option called "Save as type:"
In this path select "All files" option insted of "Text Documents (*.txt)".
if you forget to change this option then the file will be saved in text format which is not useful for execution.
5).Now a new batch file is created in the specified path.
(let us assume that the file is saved on Desktop).
6).Now to run this file,open "command prompt".
7).Type the path where the file is located.
As the file is located on desktop,enter into the desktop directory by using "CD" command.
Eg:-cd Desktop
8).Type the name of the batch file including extension or just type the filename directly.
Eg:-MyAddress.bat or MyAddress
Then Press enter.
9).Now,your name and address will be printed on the screen.
Note:-If you want to use only the file name without extensions then make sure that there is no other file exist with the same name at the same path.
10).If you have problem in execution,try to verify the above steps and try again.
Thats it,Now you have learned how to create a simple Batch program to Print Text.
Thank you for visiting my blog,I will Post some more intresting blogs and working procedure of the commands used above shortly.
Today i will show you how to create a simple Batch program.
A batch program is a text file which contain some set of commands which will be executed one by one when the file is clicked .
Now to create a batch program,all u need is a text editor such as "Notepad" and "command prompt".
"Notepad" is used to code the program and "command prompt" is used to execute the program.
To create a simple batch program which prints your name&Address follow the below steps:-
1).Open "Notepad" from start menu in the taskbar
Start->All Programs->Accessories->Notepad
2).Type the following commands one by one
@ECHO OFF
ECHO.
ECHO YOUR_NAME.
ECHO YOUR_ADDRESS.
(Here in place of YOUR_NAME type your actual name,otherwise You will not get the desired output
Simillarly,in place of YOUR_ADDRESS type your actual Address,use ECHO Command for
every new line).
Below code is an example for printing the name and address of a person named "Rohith":-
@ECHO OFF
ECHO.
ECHO Rohith.
ECHO S/O.Ramesh.
ECHO H.NO:-1-68.
ECHO Madhuranagar colony.
ECHO Hyderabad.
ECHO AndhraPradesh.
3).Save the file using (.bat) Extension
Eg:-My_Address.bat
4).Below the file name path,there will be another option called "Save as type:"
In this path select "All files" option insted of "Text Documents (*.txt)".
if you forget to change this option then the file will be saved in text format which is not useful for execution.
5).Now a new batch file is created in the specified path.
(let us assume that the file is saved on Desktop).
6).Now to run this file,open "command prompt".
7).Type the path where the file is located.
As the file is located on desktop,enter into the desktop directory by using "CD" command.
Eg:-cd Desktop
8).Type the name of the batch file including extension or just type the filename directly.
Eg:-MyAddress.bat or MyAddress
Then Press enter.
9).Now,your name and address will be printed on the screen.
Note:-If you want to use only the file name without extensions then make sure that there is no other file exist with the same name at the same path.
10).If you have problem in execution,try to verify the above steps and try again.
Thats it,Now you have learned how to create a simple Batch program to Print Text.
Thank you for visiting my blog,I will Post some more intresting blogs and working procedure of the commands used above shortly.



No comments:
Post a Comment