Command Prompt is the default Windows command-line compiler and is commonly referred to as CMD. The first version of cmd was developed by Therese Stowell for Windows NT. The maximum length of string that can be used in the command prompt is 8191 characters for the Operating System Windows XP and above and is 2047 characters for earlier versions such as Windows 2000 and Windows NT 4.0, etc. introduce you to the cool tricks with CMD that you did not know.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
In this article, AnonyViet introduces some important Windows CMD commands that can definitely help increase your performance and productivity when working on Command prompt. Check out some tips and tricks along with those commands.
Also you can see some funny tricks with CMD.
16 good commands and tricks with CMD on Windows
Keyboard shortcuts on CMD
Remembering keyboard shortcuts will increase your productivity. So CMD has some shortcuts to help you quickly manipulate commands that you need to know:
- Autofill folder names: [ Tab ]
- Repeat last executed command: [ Mũi tên lên hoặc F3 ]
- Automatically enter the last executed command character by character: [ Mũi tên phải ]
- Show history of executed commands: [ F7 ]
- Delete the contents of the current line: [ Escape ]
- Ignore the current line you are typing or the command being executed: [ Ctrl + C ]
- Delete the word to the left of the insertion point: [ Ctrl + Backspace ]
Open CMD with path as current directory
Command to move to current directory on CMD is cd đường-dẫn-cần-đến
. However if you are in a subdirectory and the path is quite long. Open that folder with Windows Explorer and in the address bar type the command cmd then press Enter.
Then, the CMD window will open and the current path will be the open directory of Windows Explorer.
Create secure folders – impregnable
If you want others to tamper with your Data, you can create a safe folder with the help of this command. The directory is created with this command cannot be copied or moved to another location or deleted by anyone. Launch CMD where you want to create folder and execute below command.
- To create a directory:
md Aux\
This command will create a Secure folder named Aux” - To delete a folder:
rd Aux\
This command will delete the folder created with the above command, make sure the folder is empty when you delete, otherwise the system will not allow to delete the folder with the command”
Hide folder
If you have some confidential data and don’t want to share it with anyone then this command will be very useful. You can hide the folder with the help of this command and no one can see it unless you unhide it. Hidden folders won’t show even if Option is turned off”Hidden items“ get Options – Views.
- To hide a folder:
attrib +h +s +r Tên-thư-mục-cần-ẩn
Eg: [attrib +h +s +r D:\AnonyViet] - To unhide a folder:
attrib –h –s –r Tên-thư-mục-cần-bỏ-ẩn
CMD command to shutdown, reboot, Logoff
If you want to shutdown, reboot and logout using CMD below commands will help you to do that.
- Restart or shut down the computer using the interface window: [ shutdown /i ]
- Put the machine in Hibernate mode immediately: [ shutdown /h ]
- Turn off the computer completely: [ shutdown /p ]
- Sign out of the current account: [ shutdown /l ]
- Turn off the computer: [ shutdown /s ]
- Shutdown in the specified timer: [ shutdown /s /t xx ] (XX is the time in seconds)
- Abort strange boot/shutdown during timeout: [ shutdown /a ]
- Reboot with advanced boot options: [ shutdown /r /o ]
- Show message before shutdown/restart: [ shutdown / c “Nội dung Thông báo” ]
Customize font size, color, size in CMD
If you are bored with the black and white CMD window then here is good news for you, you can customize it with the help of commands. You can change the title, prompt name, text color and background color of CMD with the commands below.
- To change the title of CMD: for example
title tên-tiêu-đề
, Eg: title AnonyViet - To change the name of the command prompt:
prompt tên-cần-đổi:
, Eg: [prompt AnonyViet:] - To change the background color and font: [
Color mã-màu
] Eg: [Color 03] (Type color /? to see a list of color codes)
If you want to change the font, font color, font size… you right-click on the title bar, select Properties, then there will be its own preferences window.
Create wifi hotspot to share connection
If your computer is connected to Wifi, you can use your computer to create a Wifi hotspot for other devices. Proceed as follows:
- Create hotspot:
netsh wlan set hostednetwork mode=allow SSID=WIFI-Name Key=Password of Wi-Fi
. (Password must be 8 characters or more).
Eg: netsh wlan set hostednetwork mode=allow SSID=AnonyViet Key=123456789
- Start hotspot: [netsh wlan start hostednetwork]
- Turn off hotspot: [netsh wlan stop hostednetwork]
Remove old command, clean CMD . screen
If there is too much content on the CMD screen, you want to delete it to enter other commands for easy management. Please use the command cls
. Immediately the cmd screen will return to black and no text.
List of programs installed on Windows
You can get a complete list of programs installed on your machine by typing a simple command. The time to fetch the program list will completely depend on the number of programs installed in the machine.
- To get a list of Installed Applications:
wmic product get name
List current directory
If you want to see how many subdirectories, files, and creation dates are inside the current directory, use the command. dir
.
- To get the directory listing:
dir
- To get the sorted directory list:
dir /b | sort
- To list the sorted list of folders and files with last modified date and time:
dir /s | sort
- To get a sorted list of files with complete file paths:
dir /b /s |
sort
Export the results to a file
type > log.txt
After each command, you will save the results to the log.txt file.
For example, we have the command dir
is the command to list the current directory. Now we type dir > log.txt
. Then cmd will create a file named log.txt and the content will contain the names of the directories listed by dir.
If you want to list directories with Vietnamese accents, use the following command:
chcp 65001 dir /b > log.txt
(/b lists names only)
View IP address, network information
- View computer name:
hostname
- View IPs:
ipconfig
- View detailed network information:
ipconfg /all
- View MAC address:
getmac
Check the quality of the internet, find the website IP
Command ping
is the command to check the transparency of the network connection.
To find the IP of a website, type the command ping địa-chỉ-website
. Eg: ping anonyviet.com
If no error request time out your home network connection to anonyviet.com is quite good. Index time The smaller the number, the faster the connection.
List the running processes on Windows
This is one of the best commands if you want to get a complete list of tasks running on your machine. The command will provide a list of all running processes with full details like Task name, session name, session number, memory usage status along with the username that started the task.
- To get a list of running Tasks:
tasklist
- To get a detailed list of running tasks:
tasklist /v
Execute multiple commands at the same time on one line
We can execute multiple commands in one command line using command separator && and the commands will execute in turn in the order in which they are written.
To execute multiple commands in one line: [ CommandA && CommandB && CommandC
] .
Eg: Ping anonyviet.com && Color 03 && dir
this command will ping AnonyViet’s IP, change the background color and give a list of directories.