16 Command Prompt cmd little known tricks

Command Prompt is default command line interpreter for Operating System. It is an executable file, which is also commonly refers as CMD . The initial version of cmd developed by Therese Stowell for Windows NT. Windows CE was the first embedded Windows release to support a console and a Windows CE version of cmd.exe. The maximum length of the string that can be used in the command prompt is 8191 characters for Windows XP and later Operating systems and it was 2047 characters for earlier versions like Windows 2000 and Windows NT 4.0 etc.

In this article we will discuss few important commands of Windows CMD which may definitely give some boost in your performance and productivity while working on Command prompt. Lets have a look of few tips and tricks along with those commands.

1. LAUNCH CMD IN ANY FOLDER WITH COMPLETE PATH:

IF you find difficulties to navigate the folder path in CMD then this trick is very useful for you, you can directly start the CMD with complete path using this trick.

Open file Explorer and navigate the folder where you want to launch CMD. Click on Address bar, type CMD and hit enter to launch CMD. (Make sure complete address is selected)

Open CMD in Any Folder

Open CMD in Any Folder

Open CMD in Any Folder-output

Open CMD in Any Folder-output

2. CREATE A SECURE FOLDER:

If you wish that someone does not manipulate or mess with your Data then you can create a secure folder with the help of this command. Folder created using this command cannot be copied or moved to other location or deleted by anyone. Launch CMD where you want to create the folder and execute below command.

  • To make folder: [**md Aux**] ” This will create a Secure folder named Aux”
  • To delete folder: [**rd Aux**] “This command will remove folder created by above command, make sure folder is empty when you remove it else system will not allow to delete the folder using command”

CMD Command to Create Secure folder

CMD Command to Create Secure folder

CMD Command to remove Secure folder

CMD Command to remove Secure folder

3. HIDE A FOLDER:

If you have some confidential data and don’t want to share with anyone then this command would be very useful, you can hide folder with the help of this command and no one can view it unless you unhide it. The hidden folder will not be visible even if “Hidden items” Option is checked under View setting. You can put your important data and password in the folder and hide it from spying eyes. Navigate to the folder that you want to hide and execute below command:

  • To hide the folder: [attrib +h +s +r Folder-Name] Example: [attrib +h +s +r MyFolder]
  • To unhide the folder: [attrib –h –s –r Folder-Name] Example: [attrib –h –s –r Myfolder]

CMD command to hide the folder

CMD command to hide the folder

CMD Command to unhide the Folder

CMD Command to unhide the Folder

Note: Make sure you remember the folder name that you hide using this command so that you can unhide whenever you need.

4. SHUTDOWN/RESTART/LOGOFF MACHINE USING CMD:

If you want to shut down, restart and log off your machine using CMD below commands will help you to do that.

  • Restart or shutdown computer with GUI window: [shutdown /i]
  • Put machine on Hibernate instantly: [shutdown /h]
  • Turn Off local computer: [shutdown /p]
  • Logout from the existing account: [shutdown /l]
  • Shutdown the computer: [shutdown /s]
  • Shutdown the machine in specified timer: [shutdown /s /t xx] (XX is the time in second)
  • Abort restart/shutdown during time-out period: [shutdown /a]
  • Restart with Advance boot options: [shutdown /r /o]
  • Show reason of Restart/Shutdown: [shutdown /c “Your Comment”]
5. CUSTOMIZE CMD WINDOW :

If you are bored with black and white CMD window then here is a good news for you, you can customize it with the help of commands. You can change the title, prompt name, font color and background color of CMD with below commands.

  • To change the title of CMD: [title Title-Name] example: title My CMD
  • To change the prompt name: [prompt prompt-Name] example: [prompt Home Alone:]
  • To Change the background and Font color: [Color Color-Code] example: [Color 03] (Type [color ?] to get the list of color name and code associated with it).

CMD command to customize command prompt window

CMD command to customize command prompt window

Change Default Properties of CMD using GUI Mode: Right-click on the title bar of the Command Prompt window and select Properties to Change the settings. Click on Option Tab to change Cursor size and Command history buffer. Click on Font Tab to change Font type and Size. Click on Layout Tab to change the default CMD window size. Click on Color Tab to change text color, background color and background opacity of command prompt window. Click on Terminal Tab to change the color and shape of cursor.

how to customize command prompt

how to customize command prompt

Customize CMD with GUI-Options Tab

Customize CMD with GUI-Options Tab

Customize CMD with GUI-Font Tab

Customize CMD with GUI-Font Tab

Customize CMD with GUI-Layout Tab

Customize CMD with GUI-Layout Tab

Customize CMD with GUI-Color Tab

Customize CMD with GUI-Color Tab

Customize CMD with GUI-Terminal Tab

Customize CMD with GUI-Terminal Tab

6. CREATE A WIFI HOTSPOT:

You can create a Wi-Fi hotspot using below CMD command and share it with your friends and family members. Run CMD as Administrator and execute below commands to create and start the hotspot.

  • To create hotspot: [netsh wlan set hostednetwork mode=allow SSID=WIFI-Name Key=Password of Wi-Fi] (The Wi-Fi password must be more than 7 characters). Example: [netsh Wlan set hostednetwork mode=allow SSID=Apple Key=123456789]
  • To start hotspot: [netsh wlan start hostednetwork]
  • To stop the hotspot: [netsh wlan stop hostednetwork]

CMD command to Create a Hotspot

CMD command to Create a Hotspot

7. CLEAR CMD SCREEN:

You can clear the complete CMD window with the help of a single command. This is one of most commonly used command too. Simply type [cls] and hit enter to clear the CMD screen.

8. GET LIST OF ALL INSTALLED PROGRAMS:

You can get the complete list of programs installed on your machine by typing a simple command. Time to fetch the list of programs will completely depend on the no of programs installed in machine.

  • To get the list of Applications installed: [wmic product get name]

CMD command to get the list of Applications installed on machine

CMD command to get the list of Applications installed on machine

9. COPY AND EXPORT CMD OUTPUT/RESULT:

You can copy the output of executed commands on clipboard and paste it into notepad or word to save it for future use. You can also export the results in text file directly from CMD.

  • To copy on clipboard: [command-Name | Clip] example: [dir | Clip] this command will copy the list of directories on clipboard.
  • To export in text file: [command-Name > file path with extension] example: [dir > e:\directories.txt] this command will export the list of directories in e drive with file name directories.txt.

CMD command to Copy and Export CMD output

CMD command to Copy and Export CMD output

10. GET IP AND NETWORK DETAILS:

You can get the host name and IP assigned to your machine, list of physical adapters installed on your machine and all other network related information by using below commands.

  • To get the IP details: [ipconfig]
  • To get Mac address or Physical Address of the Machine: [getmac]
  • To get the complete network details: [ipconfig /all]
11. SORTED LIST OF DIRECTORIES AND FILES:

You can get the sorted list of directories in a particular folder. Navigate to the folder whose details you want to get, launch CMD and execute below command.

  • To get the directory list: [dir]
  • To get the sorted directory list: [dir /b | sort]
  • To get the sorted list of folders and files with latest modified date and time: [dir /s | sort]
  • To get the sorted list of files with complete file path: [dir /b /s | sort]

CMD command to get directory list

CMD command to get directory list

CMD command to get detailed Directory list

CMD command to get detailed Directory list

CMD command to get sorted Directory list

CMD command to get sorted Directory list

12. OPEN WEB PAGE USING CMD:

You can open a web page using command prompt, type start command along with the website name and hit enter. Example: [start https://productaspect.com] this command will open this website in the default browser.

13. GET IP ADDRESS OF THE WEBSITE:

You can resolve the IP address associated with website or URL with the help of this command.

  • To get the IP details: [Ping website-Name] example: [ping YouTube.com] this command will give the IP address attached with YouTube.com.
  • To get the website name: [Ping –a IP-address] this command will give the host name associated with specific IP address.

CMD command to get the IP Address of a website

CMD command to get the IP Address of a website

14. GET THE LIST OF ALL RUNNING TASKS:

It is one of the best command if you want to get the complete list of running task on your machine. The command will give the list of all processes running with complete details like Task name, session name, session no, memory usage status along with user name who started the task.

  • To get the list of running Tasks: [tasklist]
  • To get the detailed list of running tasks: [tasklist /v]

CMD command to get the running Tasklist

CMD command to get the running Tasklist

CMD command to get the detailed list of running task

CMD command to get the detailed list of running task

15. EXECUTE MULTIPLE COMMANDS IN SINGLE LINE:

We can execute multiple commands in a single command line using the command separator “&&” and the commands will execute one after another in the sequence which they are written in.

  • To execute Multiple commands in single line: [CommandA && CommandB && CommandC]. For example: [Ping YouTube.com && Color 03 && dir] this command will ping YouTube IP, change the color of background and font associated with code 03 and give the list of folders.

CMD command to execute multiple commands

CMD command to execute multiple commands

16. SHORTCUTS OF CMD:

There are many shortcut keys present which you can use to enhance your performance and productivity when working in CMD. I am not gonna discuss the complete list as they are many and I need to write a separate article if I discuss all of them but few common commands are as bellows:

  • Auto complete a folder name: [Tab]
  • Repeat last executed command: [Up Arrow/F3]
  • Auto type last executed command character by character: [Right Arrow]
  • Show history of executed commands: [F7]
  • Delete the content of current line: [Escape]
  • Abort current line in which you are typing or command which is being executed: [Ctrl + C]
  • Delete the word to the left of the insertion point: [Ctrl + Backspace]

Thank You so much, i hope this article was helpful and knowledgeable to you. Please share your feedback using comment box and share this article to spread the knowledge. Happy learning and keep sharing the knowledge.

Source: productaspect

19 Likes

Awesome tricks…
Thank You

1 Like

I really liked all these tricks, keep up the good work!!!

1 Like

Nice share! I tried all the commands and definitely learnt something new

Awesome stuff. No. 1 is something I never knew and will be using this in my web development workflow.