BCA – 105: Lab on MS- Windows and DOS
Rahul Kumar Singh
In today's Lab Class we have discussed on different DOS
Internal Commands.
14) Ren and Rename Commands:-
The ren and rename commands change the name of files
and directories.
Note:- We cannot specify a new drive or path for the
destination of a renamed file.
Syntax:-
RENAME [drive:][path][directory name1 | file name1]
[directory name2 | file name2]
REN [drive:][path][directory name1 | file name1] [directory
name2 | file name2]
Examples:-
rename c:\computer hope
Change the name of the directory "computer" to "hope."
rename *.txt *.bak
Rename all text files with the ".txt" file extension to files
with ".bak" extension.
rename * 1_*
Rename all files to begin with 1_. The asterisk (*) in the
command above is an example of a wild character and can
represent one or more characters. With only an asterisk, all
file names in the current directory are renamed to have "1_"
as the first two characters.
rename "computer [Link]" "example [Link]"
Rename the file "computer [Link]" to "example [Link]".
When you are dealing with a file or directory with a space, it
must be surrounded by quotes. Otherwise, you get an error
indicating that "The syntax of the command is incorrect."
15) Ver Command:-
The ver command displays the version of MS-DOS or, if
running Windows 95 or above, the version number of
Windows.
Syntax:-
VER
Example:-
ver
Displays what version of MS-DOS or Windows command
prompt you're using. Below is an example of what you
could expect to see if you used this command in Windows
10.
Microsoft Windows [Version 10.0.19042.1415]
16) Exit Command:-
The exit command is used to withdraw from the currently
running application and the MS-DOS session.
Syntax:-
EXIT
Example:-
exit
When in another command interpreter, exit takes you out of
the new command interpreter and back into the original.
When entering DOS from Windows, exit would return you to
Windows.
If you're in the Recovery Console, exit would close the
Recovery Console and reboot the computer.
17) Erase Command:-
The erase command is used to remove files from your
computer's hard drive and other storage devices.
Syntax:-
ERASE names
Example:-
erase c:\windows\*.tmp
Delete any files that end with the TMP extension.
18) Path Command:-
Path command displays or sets a search path for
executable files.
The path command specifies the location where MS-DOS
should look when it executes a command. For example, if
you were to use the "format" command, the path must be
specified, or you will receive the message "bad command
or file name."
Syntax:-
PATH [[drive:]path[;...][;%PATH%]
PATH ;
Type PATH ; to clear all search-path settings and direct
[Link] to search only in the current directory.
Type PATH without parameters to display the current path.
Including %PATH% in the new path setting causes the old
path to be appended to the new setting.
Examples:-
path
Typing "path" by itself shows the current path information.
Below is an example of the output you may receive when
utilizing this command. As shown in the example below,
multiple directories in the path are separated by a
semicolon.
PATH=C:\Program Files (x86)\NVIDIA
Corporation\PhysX\Common;C:\Program Files (x8
6)\WinSCP;C:\Perl\site\bin;C:\Perl\bin;C:\WINDOWS\syste
m32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\WINDOWS\System32\WindowsPower
Shell\v1.0\;C:\Program Files (x86 )\Windows
Live\Shared;C:\Program Files (x86)\FAHClient;
path=c:\windows\command
The command above would set the path to
C:\windows\command, where many of the Windows
commands are located.
19) Prompt Command:-
The prompt command lets you adjust how much
information is shown in MS-DOS.
Syntax:-
PROMPT [text]
Here, [text] Specifies a new command prompt.
The prompt can be made up of normal characters and the
below special codes:
$A & (ampersand).
$B | (pipe).
$C ( (left parenthesis).
$D Current date.
$E Escape code (ASCII code 27).
$F ) (right parenthesis).
$G > (greater than sign).
$H Backspace (erases the previous character).
$L < (less than sign).
$N Current drive.
$P Current drive and path.
$Q = (equal sign).
$S (space).
$T Current time.
$V Windows version number.
$_ Carriage return and line feed.
$$ $ (dollar sign).
If Command Extensions are enabled, the PROMPT
command supports the following additional formatting
characters:
$+ Zero or more plus sign (+) characters depending on the
depth of the PUSHD directory stack, one character for each
level pushed.
$M Displays the remote name associated with the current
drive letter or the empty string if the current drive is not a
network drive.
Example:-
prompt $t $d$_$p$g
Display the time and the date above your prompt when in
DOS.