top of page
MS-DOS Commands
WHAT IS IT ?
-
Microsoft Disk Operating System, MS-DOS is a non-graphical command line operating system.
-
MS-DOS is navigated by using MS-DOS commands.
-
In MS-DOS, you would navigate to the folder using the cd command and then list the files in that folder using the dir command.
-
MS-DOS is no longer used; however, the Windows command line is still used by many users.
-
All the commands are going to work with your version of MS-DOS or Windows.

-
Here are some basic command for DOS operating system in the below table.
-
This table has some network related commands, that works with MS-DOS and all windows command line.
-
Some other useful commands are:
DOS CMD to Create a User Account
-
In command prompt, administrators can perform operations like creation/deletion of user accounts, resetting user password etc.
-
Open Command Prompt as administrator.
-
net user - Displays users on the computer.
-
net localgroup - To add, delete, view and otherwise manage network group.

Add a user account (No password)
Add a user account (With password)
Change the password.
-
After creating a user, we can add administrators rights to it.
-
Type net localgroup administrators UserName /add.
-
To remove the admin right, type net localgroup administrator UserName /del.

To add admin rights to user
To remove admin rights to user
-
To hide/unhide the Administrator account, use the following command followed by :yes or :no.
-
In the command line, type net user administrator /active :yes

Unhide Administrator User Account
Hide Administrator User Account
-
Type net user to see all the users on the computer.
-
To see the details like activities, type, password set time and etc, type net user UserName.

To see all the User Accounts
To see detail of a User Account
DOS CMD to Create a Folder or Directory
-
To create a directory in MS-DOS or the Windows command line, use the md or mkdir MS-DOS command.
-
Type md Folder1 or mkdir Folder2.
-
For multiple folder, type md Folder1 Folder2 Folder3.
-
To make a folder name with space, keep that in quotes i.e. type md "New Folder".
-
To create a directory in the parent directory, type md ..\Folder8.
-
To create a directory in the subdirectory, type md Folder1\Folder8.

Make Directory/Folder
Make multiple folders
Folder name with space
Make folder in subdirectory
Make folder in parent directory
-
To see the tree view of folder and subfolder of a directory, a command is there..
-
Navigate to the directory.
-
Type tree FolderName on the command line.

Tree view of Folder1 directory
-
Let us take another example.
-
Type tree on the command line in the current directory.

Tree view of folders & sub folder
(Not files)
Type tree to see the tree view
DOS CMD to Create a file
-
A user can create a file using the copy con command as shown below.
-
Here we create the file.txt file with giving some data.
-
Once copy con filename.extension command has been typed in, a user could type in whatever he wishes.
-
After entering data, press Ctrl + Z for saving the file.
-
Ctrl + C for cancel the file creation and press Enter.

To create a text file
To navigate directory
Type data

To create mp3 file
Ctrl + Z for saving
Ctrl + C for cancle
File created.
DOS CMD to Delete files & folders
-
If you are looking to delete a file, directory, or folder, use del, rd, and rmdir commands in DOS command line
-
For files, use del command.
-
For folder, use rd, rmdir, and deltree To delete a directory or file name with a space in the name, you must surround the directory or file name with quotes.
-
eg.
del "my example file.txt"
rmdir "my example directory"

To delete file
To delete Folder
To delete all .jpg files
To delete Folder
Keep the file/folder in the quotes, if it has space.
-
If you want to delete a directory within another directory (subdirectory), you can type rmdir Folder\Subfolder

rmdir Folder\Subfolder
Folder contains data, Folder can't be deleted
Folder contains data, Folder can't be deleted
Delete with data
To remove subfolder



DOS CMD to Encrypt a file
-
Encryption is the most effective way to achieve data security.
-
To read an encrypted file, you must have access to a secret key or password that enables you to decrypt it.
-
Encrypted a specific file can only be accessed in the same computer.
-
Decryption is also the process of decoding a cipher text into a plain text.
-
Here we use cipher command to encrypt and decript the files and folders.
-
Below is the example of encrypting files with cipher command.

Type cipher FolderName /e to encrypt
Type cipher FolderName /d to decrypt
DOS CMD to Move files from one directory to another
-
Here we will copy & move files or directories to another location on a Windows system.
-
Command for moving the file is; move directory/filename newDirectoryPath.
-
You can also rename the file while moving it to the new location; move data.docx d:\newData.docx.
-
if you want to move all text files from current folder to a new location you can use the below command.
-
move *.txt destinationDirectory
-
For a copy the file and folders, we can use the command copy.
-
copy State Country

Type move fileName destination
Type copy source destination
DOS CMD to put all the files names in a directory into a text file
-
There are different methods of printing a listing of files.
-
The method we will be using in this document is directing or sending the output to a file.
-
Get to the command line.
-
Navigate to the directory containing the content you would like a list to print.
-
Command to takes a list of all the files and all of the information about the files, including size, modified date, etc.
-
eg. dir > F:\Folder\files1.txt.
-
Command to get only the file names and not the file information of the files in the current directory.
-
eg. dir /b > F:\Folder\files2.txt
-
Command to get only file names of the files in the current directory and any other files in the sub-directories within the current directory.
-
eg. dir /b /s> F:\Folder\files2.txt

Navigate to the directory containing the content
List of all the details about files into a text file
List of only file names into a text file
List of file with .txt extension
List of a file with a .txt extension in the subfolder as well.

Text files are created.
Change the IP address using CMD:
-
Open the command prompt in a run as administrator.

Right-click > Run as Administrator
-
Check the current IP address.
-
Type "ipconfig" in command prompt.

Current IP address
-
Before you change your IP address and related information, you need to find to full name of the network for the interface you want to change.
-
To do this, type "netsh interface ipv4 show config".

Name of the network for the interface
-
Change your IP address, Subnet Mask, and Default Gateway.
-
Type netsh interface ipv4 set address name="Ethernet 2" static 192.168.0.123 255.255.224.0 192.168.0.1

interface name
Set IP Address
Subnet Mask
Default Gateway
IP got changed.
-
Change your DNS setting.
-
Google Public DNS and OpenDNS–can be faster and more reliable than the DNS servers provided by your ISP.
-
You’ll need to use the command twice: once to set your primary DNS server and once to set your secondary, or backup, DNS server.
-
For primary, type netsh interface ipv4 set dns name="Ethernet 2" static 8.8.8.8
-
For secondary, type netsh interface ipv4 set dns name="Ethernet 2" static 8.8.4.4 index=2

-
If you are using static IP address, but you want to switch to dynamic IP assigned by a DHCP server.
-
Type netsh interface ipv4 set address name="Ethernet 2" source=dhcp .

-
To get back to default DNS setting from DHCP server, open command line.
-
Type netsh interface ipv4 set dnsservers name"Ethernet 2" source=dhcp

DOS CMD to find the mac addresses of all network devices:
-
You have a private or public network with servers and workstations that are assigned static and dynamic IP addresses.
-
The router displays Static and Dynamic client lists with hostname, IP address and MAC address of the connected devices.
-
Type "arp -a" to see all connected devices and MAC addresses as well.

Type arp -a to get MAC addresses of connected devices in local network.
IP address, MAC address & IP type of our network devices.
DOS Command to Know the system information:
-
systeminfo command: Displays complete system information for Microsoft Windows computers.
-
The systeminfo command is an external command that is available in the below Microsoft operating systems as systeminfo.exe in Windows XP, Vista, 7,8, and 10.
-
The below command would display information about:
-
The computer
-
The operating system
-
Networking information
-
Installed hotfixes
-
Network card
-
and morel

Type systeminfo to get system information.
System Information
DOS Command to See Time & Date:
-
There are time and date command in MS-DOS to trace time.
-
You can even change the date and time.

For Time
For Date
-
Press Enter, For no changes.
DOS Command to Trace the time to go to the Server:
-
A traceroute (tracert )is a function which traces the path from one network to another.
-
It allows us to diagnose the source of many problems.
-
It will generate a list of the connections along the way and some information about the speed of the steps along the way.
-
Type tracert hostname, where [hostname] is the name of the server connection you are testing.

Tracing Root of a Host (stoneprofits.com)
bottom of page