Sunday, 23 November 2014

Type of Commands

No comments :

Type of Commands

In this tutorial we are going to explore something about type of commands of Batch programming. There are basically two type of commands that we can basically run from our command prompt in our language we called it CMD. These commands are :- 
1. Internal Commands
2. External Commands

Let's expands some time with them.
Internal Commands
There are some commands that are in-build, means these are comes with Operating System. We need not to worry about these will surly work if Operating System Supports. There are many Operating System in the market like Windows's XP, 7, 8, 8.1. we are not going for Linux, on Mac  here due to we are talking about batch programming and batch programming is only for windows Operating System.
There are some example of internal Commands:- echo, del, dir.


External Commands
External commands are the commands that are often created while installing a new application
and these commands mostly have no use except calling that application and support files. Means These commands are ships with Application and extend the use of our CMD. Due to Extension of working of command prompt from external application these are knows as External Commands. Few external commands can only be executed in the ‘Run’ dialog box (start → Run), but not on the command prompt, and those commands include ‘firefox’. The ‘firefox’ command can be executed only from the run line, that too if the firefox application is installed on that machine and it won’t work on the command prompt. Likewise the ‘firefox’ there are various other external commands such as the “PsTools” which includes commands like, PsExec, PsFile, PsGetSid, PsInfo, PsKill, PsList, PsLoggedOn and so on.

Monday, 17 November 2014

How to create a Batch Program -2

No comments :

Explanation of First Batch Program


In this tutorial we are going to learn some more interesting and some technical things about Batch programming. In previous tutorial we have already learn that how to create a simple Bach Program, we also learnt that how to execute it and what are the basic things which we have to have in our mind while we are executing any batch (.bat) program.
form the previous example, can you tell me what was the first line of code :). 
@echo off, this was the line what I am expecting from you. 
                                                            Lets explain it 
'echo’ is the command used to print (Display) text on the screen, so whatever that follows the echo
command will be displayed on the output screen. This command is just like the ‘printf',  statement in the C language, or println in java.
Till now every thing was OK, but problem is why we are using off after it or @ before it if it used for printing something and it is noting printing on screen (from very first echo, second Echo was OK) in the output of the program
                              Let me tell me what was the reason behind it.
When you type the echo command alone, then it will tell you whether the ‘echo is ON’ or ‘echo is OFF’.
It’s always recommended to turn the echo off, else it will display the prompts like (C:\>) and so on. In 
order to avoid the prompts being displayed, the echo is turned off by using the command “@echo off” or 
simply by using the “echo off”.
Please have a look on your own code and try to do whatever I have told you in the previous explanation. 

Explanation of last two lines:- 
1.“Echo Hello World” will display the “Hello World” on the output screen, and the 2. pause command is used to wait for the user interaction, whether to proceed further or not. If the pause is not used, then the batch will terminate immediately after displaying the “Hello World”. In this case you may not able to see the output of the above program. 

This is all about your previous program what we done before. In the next tutorial we will going to explore something about type of command, I can understand that you might thing that I am using command word more frequently but what is command, we haven't read anything interesting about it. in the next tutorial we are going to have a very nice drive of commands in Batch programs.