Skip to main content

Basic Dos Commands with examples

Command and Usage Examples
ATTRIB
Change file attributes. '+' adds an attribute, '-' removes it. Attributes are: A=archive; R=read only; S=system; H=hidden.
ATTRIB -R -A -S -H <VIRUS.EXE>
All these attributes will be removed from virus.exe.
C:
Go to the C: drive. Similarly A: and D: etc.
C:
CD
Change directory. When you change directory, the prompt changes, showing the path of the directory you are currently in.
Note, directory is the term used by DOS for what Windows calls a folder.
CD\ takes you to the top of the directory tree (typically to C:) . CD.. moves you one level up the directory tree (i.e. up towards the root directory).
CD <DIRECTORYNAME> takes you to that directory. You can use one or more subdirectory names, separated by \ e.g.
CD WINNT\Media takes you to the directory C:\WINNT\Media
To change to another path, type the full path with slashes. e.g.
CD \WINDOWS\SYSTEM
CLS
Clear the screen.
CLS
DEL
Delete one or more files in the current directory. Can be used with the '*' and the '?' wildcards. DEL *.* will delete ALL files in the current directory, USE WITH CAUTION.
(Note: DEL cannot be used to delete directories. Use RD to remove a directory.)
DEL <VIRUS.EXE> deletes virus.exe DEL *.JPG will delete all files with the extension JPG.
DEL MY*.* will delete all files beginning with MY and with any extension.
DEL MY??.* will delete files that are 4 characters long and begin with MY and with any extension.
DIR
Displays the contents of a directory (folder). Note, directory is the term used by DOS for what Windows calls a folder.
These switches can be combined, so DIR /W /P will return multiple rows listing a page at a time.
You can use the '*' and the '?' wildcards to search for a particular file. The ? character represents ONE character, and the * character represents multiple characters.
DIR *.* lists all the files in a directory.
DIR displays all files and folders in the current directory. Folders are indicated in the list by <DIR>.
Files are usually listed by name.
DIR /P displays the contents a page at a time, i.e. as many as will fit in your command line window. Press any key to display the next page.
DIR /W displays the files/folders in multiple rows. This view gives less information per file.
DIR *.JPG displays all files with the extension JPG in the current directory and all subdirectories.
DIR MY??.* displays all files beginning with MY, exactly 4 characters long, and with any extension.
DIR /S lists the contents of all subdirectories.
DIR /AH displays all hidden files.
EDIT
Runs DOS EDIT (a simple text editor). Useful for editing batch files and viewing logs. This command requires QBASIC.EXE to be present.
EDIT <VIRUSLOG.TXT> opens the file viruslog.txt and allows you to edit it.
EDIT <NEWFILE.TXT> creates a new file called newfile.txt and opens it up for you to edit.
HELP
Displays DOS Help. For help on an individual command, type HELP then the command for which you want more information.
HELP DIR displays information on the DIR command.
MD
Make directory. Creates a new directory below the current one. (The command can also be written as MKDIR)
MD <NEWDIR> creates a new directory called Newdir.
PRINT
Prints the specified file (if the printer is supported in DOS - many are not).
PRINT <LOGFILE.TXT>
Prints LOGFILE.TXT
RD
Remove directory. Removes a subdirectory of the current directory. The directory you want to remove must be empty of all files. (The command can also be written as RMDIR)
RD <DIRECTORYNAME>
RENAME
Rename a file. You must use the full file name including the suffix.
RENAME <OLDNAME.EXE> <NEWNAME.EXE>
TYPE
Displays the contents of a file on the screen. If you use this command on a file which is not a text file, the display will be unintelligible. Use with "|MORE" to display the text on a page by page basis, and prevent it scrolling off the screen. "|" is a pipe character.
TYPE C:\FileName.TXT|MORE
>
When you run a DOS command, output is usually sent to the screen. Use > to redirect output from the screen to a file. It runs the command preceding the >, creates a file in the current directory with the name you specify, and sends the information/output returned by the command, to that file.
COMMAND > FILENAME.TXT
e.g. SWEEP > REPORT.TXT The details of any infected files reported by SWEEP are sent to a file called REPORT.TXT.

Comments

Popular posts from this blog

Steps to remove google accounts from Computer

Open Google . You will see a round shaped picture of google account picture in top right corner as marked in below picture Click on it. Click on sign out of all accounts Click on Sign In at the top right corner as shown in picture below. Click on it. You will see following screen. Select your desired account from it and sign in . Reopen your form by clicking link provided to you, It will be open now.

Steps of splitting pdf files

Goto https://www.ilovepdf.com/split_pdf Click on Select PDF File. Upload your pdf file here. Select Extract Pages from right menu. Click on Split pdf button and wait for the procedure. Now Click on Download Split PDF and you will get a zip file in which there will be separate pdf.

Introduction to Object Oriented Programming ( OOP )

Object-Oriented Programming Object Oriented programming is a programing model that is based upon data and object. Classes   Classes are the blueprint of objects. Now you will think about what actually blueprints are. Blueprints are actually a design or plan to build something. Let's take an example like the map is detail plan of house classes are detail plan in  Object-Oriented programming. let's give you an example of a class on java so that you can unferstand. public class Car {          int horsePower;     String name;     String color;      String Company; } public class Sample {     public static void main(String[] args) {         Car car;         Car mehran;             } } Class name always start with capital letters . It is a good practice to name classes .  We will later learn how this is good. So in the above class Car ...