Monday, 22 September 2014
Mode of commands
Modes of commands
In this tutorial we are going to learn about "modes of commands".
Modes:
There are two different modes that are supported by DOS (Disk Operating System), they were.
1. Interactive Mode,
2. Batch Mode (Silent Mode).
There are two different modes that are supported by DOS (Disk Operating System), they were.
1. Interactive Mode,
2. Batch Mode (Silent Mode).
Interactive mode:-
In interactive mode, when a command is executed, it interacts with the user for input and depending upon the input supplied by the user, the further processes are carried out. For example, let’s take the ‘del’ command. The ‘del’ command is used for deleting files that reside inside a directory. Now I am going to delete all the files inside a folder named ‘abc’, and when I executed the following command, it is interacting with me prompting “Are you sure (Y/N)?”, confirming the deletion operation, and depending upon my input, it decides what to do. If I hit ‘Y’ then it will delete the files specified, else if I hit ‘N’ then it won’t delete.
In interactive mode, when a command is executed, it interacts with the user for input and depending upon the input supplied by the user, the further processes are carried out. For example, let’s take the ‘del’ command. The ‘del’ command is used for deleting files that reside inside a directory. Now I am going to delete all the files inside a folder named ‘abc’, and when I executed the following command, it is interacting with me prompting “Are you sure (Y/N)?”, confirming the deletion operation, and depending upon my input, it decides what to do. If I hit ‘Y’ then it will delete the files specified, else if I hit ‘N’ then it won’t delete.
C:\>del abc
C:\abc\*, Are you sure (Y/N)? y // it will delete all files from my abc directory.
if I execute C:\abc\*, Are you sure (Y/N)? n // it will not going to effect my any files from abc directory
C:\abc\*, Are you sure (Y/N)? y // it will delete all files from my abc directory.
if I execute C:\abc\*, Are you sure (Y/N)? n // it will not going to effect my any files from abc directory
Batch Mode (Silent mode ) :-
Batch mode can also be referred as ‘Silent mode’ or ‘Quiet Mode’, and this is mere opposite to the interactive mode. The command that operates at batch mode will never interact with the user at any instance, instead it will take care of every operation by itself. For example, I am going to explain this by using the same ‘del’ command. There is a switch available for the ‘del’ command, which makes the command to operate at silent mode, and that switch is ‘/Q’
C:\>del /Q abc
C:\>
In this case, this does not ask me to delete my files from abc directory, the command is not at all interacting with me, whether to delete those file or not. In the above example, I have tried to delete the same files in the same folder by using the same command but with a different switch. Anyhow both the commands will perform the same operation but the mode it operates differs. first was in interactive mode and another one in silent mode.
Thursday, 18 September 2014
How to open Command Prompt
How to open Command Prompt
In this tutorial we are going to learn "How to open command prompt in various Microsoft Windows Version Like windows 7, windows 8 and Windows 8.1 " because it is very essential to move farther in next tutorials . First of all we are going to learn something about command prompt.
command prompt is the command-line interpreter on OS/2 and eComstation, and Windows NT (Windows New Technology) operating system. It is the analog of COMMAND.COM in DOS and windows 9x systems, in these system It is known as "MS-DOS Prompt".
In reality, CMD is a windows program situated inside System32 folder inside windows. It act as DOS-like command line interpreter.
Opening Command prompt in windows 7
There are two conventional ways to start a Command prompt.
- Start → Programs → Accessories → Command prompt
- Start → Run and type "cmd" (minus quotes) and press enter.
The screenshot below shows a Command Prompt on Windows 7 Windows.
Opening Command prompt in windows 8 and 8.1
There are three conventional ways to start a Command prompt.
- Start → windows system ( just after scrolling left side in windows 8 and in windows 8.1 after tab → enter → left scroll ) → Command prompt,
- Start → type cmd and press enter
- Start → Run and type "cmd" (minus quotes) and press enter.
The screenshot below shows a Command Prompt on Windows 8 Windows.
Wednesday, 17 September 2014
Batch Programming Overview
Batch file programming is the native programming offered by the Microsoft Windows Operating
System. Batch file is created using any text editors like notepad, WordPad, WinWord or so on, which
comprises of a sequence of built-in commands used to perform some often done tasks like deleting a
series of files of same type or of different type, creating logs, clearing unwanted craps from your
computer and even for creating a batch VIRUS.
batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the Command Interpreter.
A batch file may contain any command the interpreter accepts interactively at the command prompt. A batch file may also have constructs (IF, GOTO, Labels, CALL, etc.) that enable conditional branching and looping within the batch file.
Batch file is really helpful in automating tedious tasks and for maintaining system logs. The commands used while creating a batch file are case insensitive, in the sense that it may accept both small and upper case letters.
It is container for shell scripts.
File name extensions
.bat: The first filename extension used by Microsoft for batch files. This extension runs with MS-DOS and all versions of Windows, under COMMAND.COM or cmd.exe, despite the different ways the two command interpreters execute batch files. COMMAND.COM is a DOS program. Programs executed by COMMAND.COM are DOS programs that use the MS-DOS API to communicate with the operating system (DOS).
.cmd: Used for batch files in Windows NT family and sent to cmd.exe for interpretation. COMMAND.COM does not recognize this filename extension, cmd.exe scripts are not executed in the wrong Windows environment by mistake. In addition, "set
", "path
", "assoc
" and "prompt
" commands, when executed from a .bat file, alter the value of the "errorlevel" variable only upon an error, whereas from within a .cmd file, they would affect errorlevel even when returning without an error. It is also used by IBM's OS/2 for batch files.
.btm: The extension used by 4DOS and 4NT. The scripts that run on 4DOS and 4NT are faster, especially with longer ones, as the script is loaded entirely ready for execution, rather than line-by-line.
Batch Programs
A batch program can vary from 1 lines to millions of lines and it should be written into one or more text files with extension ".bat",".cmd",".btm"; for example, hello.bat. You can use "Notepad++", "Notepad", " MS Word" or any other text editor to write your Batch program into a file.
Subscribe to:
Posts
(
Atom
)