Write any three directory commands with their functions and examples.
Answers
1) MD (or MKDIR) - This command creates a new directory or subdirectory. (Actually,
since the root is the main directory, all directories are subdirectories.
So I will refer to subdirectories in all of the following.) Optional argument
is the PATH, but if no PATH is included, the subdirectory will be created
in the current working subdirectory
Example:
C:\>md letters
This would create the subdirectory C:\letters
With a path included, you can create a subdirectory anywhere.
C:\>md c:\letters\love
If you are in a different working subdirectory:
C:\letters\>md love
This would have the same effect as the previous example. Since
we were already in the C:\letters subdirectory as our current working subdirectory,
we can leave out the path information since this is where we want the subdirectory
created.
Limitations: The length of a PATH specification cannot exceed
63 characters, including backslashes.
====================
2) RD
This command removes a subdirectory.
The RD command can sometimes be a little confusing because of
the safeguards that DOS builds into the command. The idea that you cannot
delete a subdirectory that has contents, for instance, is a safety measure.
(DELTREE gets around this, but is a dangerous command for precisely that reason.)
How can you tell if a subdirectory is empty? By using the DIR command to display
its contents.
=================================
3) CD
This command changes the current working subdirectory to another
subdirectory. Imagine a computer with the following directory structure:
c:\
\letters\
\love\
\business\
\memos\
\school\
\Internet\
Right now you are in the working subdirectory C:\letters\love\.
If you want to change to c:\letters\business\, you need to specify the path:
c:\letters\love\>cd c:\letters\business
If, however, you were in the working directory C:\letters\,
you would not need to use the path since the default is to go “downwards”:
c:\letters\> cd business
You can also use shortcuts:
cd \ will take you back to the root directory from wherever
you are.
cd .. will take you the parent subdirectory of the current working
subdirectory. So in the first example, you could also go in a two-step process:
c:\letters\love\>cd ..
c:\letters\> cd business
cd . will not do anything, but it is a valid command. The single
dot means the current working subdirectory, which is where you already are.<g>
Answer:
1) Cal
- This command will print a calendar for a specified month and/or year
- To show this month's calendar, enter cal
- To show a twelve-month calendar for 2008, enter:
cal 2008
- To show a calendar for just the month of June 1970,
- enter:
- cal 6 1970
2) date
- The date command displays the current day, date, time, and year.
- To see this information,
- enter: date
3) mkdir
- This command will make a new subdirectory.
- To create a subdirectory named mystuff in the current directory, enter: mkdir mystuff
- To create a subdirectory named morestuff in the existing directory named /tmp, enter: mkdir /tmp/morestuff