How to use Command Prompt, how to use cmd on Windows

Hidden deep within Windows is a world of command lines that few people know about. In this article, we'll show you how to troubleshoot errors and make your computer more secure.

Before Windows, when you turned on a computer, you would see nothing but a C:\> prompt and a mouse cursor. It was known as the command prompt (or sometimes Dos prompt). In order for the computer to do anything, you would have to type in the cmd command from its internal memory.

However, this method of using a computer is really unattractive and some people even want to go back to using the Dos prompt.

But would you believe that the command line still exists in all versions of Windows? Why? The reason is that commands are still a fast and powerful way to manage many aspects of Windows without having to deal with a complicated graphical interface.

How to use Command Prompt, how to use cmd on Windows

As we will see in this article, the command line can be a useful tool for debugging and testing, monitoring for errors, and even improving security.

Still, we have to admit that command line commands are free tools; while they are not always necessary, learning the basics can help users uncover the mysteries of Windows' inner workings.

Before we get started, there are two things you should remember. First, this article is not for beginners or those who are afraid of change. Second, back up your computer before doing this: we are not responsible for any problems that arise when you use the command line.

Table of Contents

What is Windows Command Prompt?

Before Windows came along, an operating system called MS-Dos – short for Microsoft Disk Operating System – dominated the computer world. It provided the link between the user and the computer hardware and was text-based, requiring only a keyboard to operate.

Technically, MS-Dos uses something like a command-line interface (CLI), while Windows uses a graphical user interface (GUI).

Versions of Windows operating systems prior to XP require MS-Dos to function because Windows itself cannot access the computer's BIOS. BIOS stands for Basic Input/Output System.

Users could choose to run Dos or Windows when the computer started, and obviously everyone chose Windows.

Windows XP introduced a tool called Command Prompt , which still exists in both Windows 7 and Windows 10. It is quite similar to MS-Dos but it is actually just an emulator of MS-DOS running inside Windows.

How to use Command Prompt, how to use cmd on Windows

Technically, Command Prompt allows access to a few lesser-known tools and settings. Because it doesn't require graphics, Command Prompt is fast and can be used to perform tasks that Windows can't in some cases.

Of course, there are some drawbacks, not the least of which is the arcane nature of the commands. Microsoft provides a comprehensive list of commands, how to use them, and a wide variety of options. Click here for the Windows XP list and click here for the Windows Vista/7 version .

Command Prompt Availability

Command Prompt is available on all Windows NT-based operating systems, including Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, and Windows 2000, as well as Windows Server 2012, 2008, and 2003.

Windows PowerShell, an advanced command-line interpreter available in recent versions of Windows, supplements the command execution capabilities available in Command Prompt. Windows PowerShell may eventually replace Command Prompt in a future version of Windows.

Windows Terminal is another Microsoft-approved way to use Command Prompt and PowerShell in the same tool.

When Windows Explorer is the best

While Command Prompt is a powerful tool, we don't think it's the easiest or best way to perform tasks. Some commands can seem a bit complicated, either because they're long strings of characters or because they have too many parameters.

It is easy to make mistakes due to users not paying attention when typing, so it is better to use Windows Explorer to manage files on a daily basis.

Additionally, command line operations are inherently dangerous – there are several “ No, Yes or Cancel ” confirmation dialogs and no Undo command (files deleted in Command Prompt cannot be restored from the Recycle Bin), so sometimes actions taken cannot be undone.

Using the wrong parameters and the wrong files can also cause them to be overwritten – possibly even corrupting Windows system files.

Getting Started with BIOS

Remember when we mentioned Bios? While not exactly a command line tool, Bios is a very important part of Windows and depending on your computer manufacturer and model, it can include some very useful security tools.

How to use Command Prompt, how to use cmd on Windows

To find them, restart your computer, then press the Bios-specific key to access it – usually F2 or Delete ( Del). When the Bios screen appears, find an entry called Security and navigate to it with the arrow keys.

In most cases, there will be options for the user to set a Supervisor password and a User password . If you set a User password, this password will need to be entered before Windows will operate (of course, Windows also has passwords).

If you set a Supervisor password, this password needs to be entered before accessing the Bios – improving security.

While there are ways to reset or disable these passwords, these techniques are beyond the capabilities of most current techniques and provide a very useful extra layer of security. For that reason, users should exercise extreme caution when using these tools: forget your password and you could be completely locked out of your computer. So be careful.

Also, look for an option called “ Boot Sector Virus Protection .” When this option is enabled, no software will be able to write to the important boot sectors of your hard drive, as some viruses do. However, be aware that some software—partitioning software in particular—has a legitimate reason for doing this. So beware of false positives.

When finished, exit Bios (usually using the Esc key ) and choose to save the changes you just made.

How to open command line tool

Now, run Windows to access the command line tool: you'll find it in the Accessories menu from All Programs in the Start menu . Alternatively, users can use the Windows key + R , then type cmd.exe into the Open dialog box and click OK .

In Windows Vista/7, sometimes users will need to use admin rights to open it. To do so, right-click on the command line icon and select “ Run as administrator ”.

Inside the dialog box

The Command Prompt has a few drawbacks. In Windows XP, it opens and displays the C:\Windows folder (or “directory”, as it is often called in this environment) but in Windows Vista/7, it opens in the user's home directory ( C:\Users\[username ]) unless Administrator mode is used, when it opens in the C:\Windows\system32 directory . No matter where it is opened, this directory is treated as a path.

However, in Windows Vista/7 Command Prompt can be opened in any folder in Windows Explorer by pressing the Shift key while right-clicking on the folder, then selecting “ Open command window here ” from the pop-up menu.

To switch to another folder or path, the CD command is used – to change to the directory named C:\My Directory , type cd c:\My Directory and press Enter . To switch between drives, simply type the drive letter name and a colon (e.g. D:) then press enter.

For most commands, typing /? after it (or help before it) will display very detailed help information. “ Help ” will display a list of all available commands. When switching between commands, you must precede it with a / or (minus sign); check the help text to see which command to use.

How to use Command Prompt, how to use cmd on Windows

Some special text characters are commonly used in the command line. The pipe character ¦ sends the result of one command to be used with another command. On most keyboards, it is typed by pressing the Alt Gr key and the key to the left of the number 1 on the keyboard.

Another commonly used character, especially when working with files, is the asterisk * , which represents any sequence of characters.

For example, *.xls means files with the file extension XLS. Letter.* means any file named Letter, and *.* means all files. The question mark represents a single character – so Letter?.* would include Letter1.doc, Letter2.pdf, etc.

Pressing Enter is always the way to execute commands, so to avoid repetition we will not mention it again. To clear the screen, use the CLS command , to exit the command line type exit (or just click the red cross to close the software window).

Use the Internet safely

One of the most powerful commands to execute in the command line is net. It has a lot of sub-commands. For example, executing the command net user will list all the account names, while net config workstation will display the computer name, user, and workgroup.

More useful in terms of security, it can also be used to prevent users from logging in at certain times. To restrict user Janet from using the computer between 9am and 6pm during the week and 10am and 9pm on weekends, type net user Janet /times:MF,09-18;Sa-Su,10-21 .

The net accounts command is great for improving password security. It requires the command line to be opened with administrator privileges (as explained above) and it will display password information about the current user.

People tend to choose short passwords and stick with them for a long time. However, the net accounts command can be used to break this habit. For example, to force each user to set a password that is at least 10 characters long and to change their password every 90 days, type net accounts /MAXPWAGE:90 /MINPWLEN:10 .

Users who use passwords that are too short will be prompted to create a new password at their next login. To remove this restriction, type net accounts /MAXPWAGE:unlimited /MINPWLEN:0 . (note the space after “accounts).

Windows also has a built-in Guest account, which has no password and cannot be changed within Windows. Although this account is not enabled by default, password protection of it adds to the security.

In the administrator command line, type net user guest * , then type the password twice when the window appears (the characters will not appear on the screen). To remove the password, press Enter twice when the password screen appears. Additionally, this command can be used to change or remove the password of any user by replacing guest with the user name.

Safe copy and faster backup

While we have copy, del (delete) and move commands for files (type command + /? to learn more), xcopy is a more powerful alternative. Users can apply this command to a wide range of tasks and it is even more reliable than using Windows Explorer.

For starters, xcopy can copy an entire folder or hard drive, including all hidden files, to a new location. It even selectively copies files based on whether the file is older or newer than the copy.

For example, if you want to copy everything on drive C: to drive D:, use the command xcopy c: d: /d /s . After a few days, use the command xcopy c: d: /d /e /s to copy the newly created files. This is a quick and very safe way to backup.

There are many other uses one can use with xcopy – to copy hidden (or system) files, use the /h switch , and to copy only files that already exist in a location, use the /u switch .

When using address book names, users will need to close these commands with quotation marks. For example, xcopy “ C:\Old Documents ” “ D:\Backup Documents ” /e /s . (note, there is a space after xcopy).

Detect suspicious activity

So far, we have looked at ways to use the command line to improve security and perform certain tasks more quickly and securely. However, knowing how to use and operate a computer using the command line will also help identify and find security threats.

For example, finding out which software or service is connected to the internet is a time-consuming task in Windows – but the netstat command simplifies the task. In the administrator command line, type netstat -b to display all active connections: the software responsible for each connection is shown in the Proto column .

The Foreign Address column will show the URL or IP address of the remote home page (details about any IP address can be captured from an IP checker site or with the Sysinternals 'whois' tool).

Meanwhile, the Windows boot-logging tool provides a powerful way to find out which drivers and services are misbehaving or rogue, such as those that install malware (spyware, viruses, etc.). It does not require specific command line instructions but understands how the command line works, making it easy for the tool to read and interpret files created by boot-logging mode .

To understand this, restart your computer and press the F8 key before the Windows logo appears. When the Advanced Options menu appears, use the arrow keys to select Enable Boot Logging and press Enter . (In Windows XP, if any other menu appears, just press Enter to continue).

When Windows is running, open a command line window with administrator privileges and type cd %windir% to switch to the Windows address book. Next, type start notepad ntbtlog.txt to open the boot-log file in Notepad.

How to use Command Prompt, how to use cmd on Windows

All drivers in the order they are loaded, repeating the full path, will be listed – and this information is much more useful when the concept of address book paths (mentioned above) is accepted. But how useful is this from a security perspective?

If the computer is working properly, save this log file somewhere for future comparison if problems arise. Close Notepad and return to the command line. Type del ntbtlog.txt to delete the log file (if not deleted, the next time the log is started, the results will be appended to the end of the current file).

If you think your computer has recently been infected with a virus, this method can be used to point out new drivers or services that are acting suspiciously: compare the previous boot-log file (ntbtlog.txt) with the most recently created file.

Run Windows software from the command line

Almost all Windows software can be launched from the command line. This may sound a little crazy, but it is actually very useful.

Many command line switches can enable or disable certain features, whether for convenience or for security or troubleshooting purposes. The formula is to use the start command, followed by the name of the program. For example, to start Wordpad, type start write.exe . For Notepad, use start notepad.exe and for Word, use start winword.exe .

Some software has a special diagnostic mode. To run Internet Explorer with all add-ons disabled, type start iexplore.exe -extoff and to open Excel in Safe Mode, type start excel.exe /s .

Additionally, to discover an application's software name, right-click its entry in the All Programs menu and select Properties . Search the Target dialog box for a file name that ends in .exe.

You may be disappointed, but there is no easy way to find out what the command-line options are for a particular piece of software. If the software manufacturer does not provide this information on their website, try searching online for “command -line options ” along with the name of the software.

Fight the infection

Similarly, Windows’ running tasks are also listed when the user uses the tasklist command. This command will show the programs that are running and how much memory they are using. This is also a very useful way to detect malicious programs – they may be running without your knowledge.

Use tasklist /svc to list the services associated with each program. The ( > ) character can be used to save this list to a file – for example, tasklist > tasklist.txt . Use this information to compare with a search engine like Google to find suspicious tasks or services.

Finally, there's a special Safe Mode option that can load a command line instead of the Windows Desktop, which is useful if the malware has disabled graphical Safe Mode (some fake antiviruses do this to make it harder for users to uninstall). In the Advanced Options menu, select Safe Mode With Command Prompt .

One application for this is to run System Restore. From a command prompt, type cd %windir%\system32\restore .

After pressing Enter , execute the rstrui.exe command to run the System Restore wizard. To run the Windows Desktop, type start explorer . To shut down the computer using the command, use shutdown -s to shut it down or shutdown -r to restart the computer.

Customize Command Prompt in Windows

All customization options for Command Prompt are available in the Properties section. To do this, launch Command Prompt, right-click on the top bar, and select Default or Properties.

  • Changes made via Default mode will not affect the current session. However, it will apply to all new CMD sessions, regardless of which Command Prompt shortcut you use.
  • Changes made via Properties mode will affect the current session and the properties of the CMD shortcut you customize.

Change Command Prompt font size and style

How to use Command Prompt, how to use cmd on Windows
Change Command Prompt font size and style

If you prefer a bolder and larger font for your Command Prompt, you can change the font type and size.

To change font type and size CMD:

1. Open the Font tab in the Properties window .

2. Under Size , select the font size you want to set as your default. You can go as low as 5 pixels and as high as 72 pixels.

3. Next, select the font type you want to set for CMD. Microsoft recommends using True Type fonts on high DPI displays for better display.

4. You can see the selected font and size in the preview window.

5. Click OK to save the changes.

Change Command Prompt Layout

How to use Command Prompt, how to use cmd on Windows
Change Command Prompt Layout

If you don't like the default CMD window position or screen buffer size, you can change them from the Layout tab.

1. In the CMD Properties window , open the Layout tab.

2. In the Screen Buffer Size section , change the value to specify how much content you can see. Leave the default option if you're not sure what the right size is.

3. Next, in the Window Size section , you can make the CMD console larger or smaller.

4. In the Window Position section , you can specify the starting position of the window by changing the Left and Top values.

5. Check the Let system position window box to let Windows decide the best starting position.

6. Click OK to save the changes.

How to change Command Prompt background and text color

How to use Command Prompt, how to use cmd on Windows
Change Command Prompt text background color

You can also customize the Command Prompt's background and text colors, whether you want to make it easier to read or simply look nicer.

1. In the Colors tab , select the value you want to change.

2. You can customize Screen Text, Screen Background, Popup Text and Popup Backgrounds .

3. Next, click on one of the predefined color elements to select the appropriate color. Change the selected color value to set the desired RGB color combination. If you want to set a specific color or shade that is not available in the Colors tab , use the online color picker to find the exact Red, Green , and Blue values ​​and make changes accordingly.

4. Click OK to apply the changes.

How to Customize Background Color Using Command Prompt

How to use Command Prompt, how to use cmd on Windows
Change Command Prompt Color Using CMD

You can use the color command to change the background and text color of Command Prompt without changing the default settings. Here's how to do it.

1. Open Command Prompt and enter the following command to get the available color properties:

color /?

2. The color property is specified by two hex digits - the first digit corresponds to the background; the second digit is the foreground. You can choose any color from the specified value as long as the background and text colors are different.

For example, if you want to set a black background with blue text, enter the following command:

color 01

To restore the default color scheme, enter the following command:

color

Make Command Prompt window transparent

How to use Command Prompt, how to use cmd on Windows
Make Command Prompt window transparent

If you're tired of the default blank look of Command Prompt, you can make it transparent. This not only allows you to maximize your screen space, but also adds a rich background from your desktop or apps.

To make Command Prompt transparent:

1. Right-click on the top bar of Command Prompt and select Properties.

2. In the Properties window , open the Colors tab.

3. At the bottom, drag the Opacity slider to adjust the transparency. Experiment with the slider to get the best look.

4. Click OK to save the changes.

Alternatively, you can use keyboard shortcuts to change transparency settings. With the Command Prompt window open, press and hold Ctrl + Shift + drag the mouse button up/down to change the transparency level - useful if you want to change transparency settings for only the active session.

Customize Command Prompt using Terminal settings

How to use Command Prompt, how to use cmd on Windows
Customize Command Prompt using Terminal settings

The Windows 10 May 2019 Update added new experimental console features, including a Terminal tab. This lets you customize and change the cursor shape, color, and more for Terminal.

To customize Terminal settings:

1. Open the Terminal tab in the Command Prompt Properties window .

2. Next, in the Terminal Colors section , select the options you want to change. Experiment with the red, green, and blue settings to choose RGB colors for Separate Background and Separate Foreground .

3. You can also change the cursor style to Underscore, Vertical Bar, Empty Box or Legacy Style .

4. In the Cursor Colors section , select Inverse Color to automatically set the cursor's inverted color based on the background color. Otherwise, select Use color and change the RGB color values ​​to set your own color combination.

5. To disable infinite scrolling, select the Disable Scroll-Forward option in the Terminal Scrolling section.

6. Click OK to save the changes.

Customize command history and edit options in Command Prompt

How to use Command Prompt, how to use cmd on Windows
Customize command history and edit options in Command Prompt

If you want to dig deeper, you can customize other Command Prompt properties using the Options tab. This includes options to change the cursor size and Command History to increase or decrease the buffer size and number of buffers.

In the Edit Options section , you can enable or disable Quick Edit Mode, Insert Mode , Ctrl shortcuts , filter clipboard contents when pasting, and use Ctrl + Shift + C/V as Copy/Paste .

In the Text Selection section , you can enable Line Wrapping and extended text selection keys.

Whether you want to change the boring black background and default white text or you want to make the CMD window transparent to add a lively background, these settings will help you give the Command Prompt the makeover it deserves.

Conclude

In this article, we’ve shown you how to explore the “underworld” of Windows to help improve your computer’s security and perform a few tasks. It may sound a little old-fashioned, but it’s still one of the best ways to know what’s going on with Windows. Spending a little time learning the basics will pay off many times over when you want to prevent or solve security-related problems.

See also:

Sign up and earn $1000 a day ⋙

Leave a Comment

Instructions on how to upgrade RAM on PC and laptop

Instructions on how to upgrade RAM on PC and laptop

Installing more RAM is the most effective solution to speed up your computer. Even if your computer is new, after only a few years of use, you will have to install more RAM to ensure better speed. In addition, new operating systems also require more memory. When a computer does not have enough RAM, it will exchange data streams with the hard drive, and that is the reason why your system runs slowly.

Instructions for canceling Gemini Advanced subscription

Instructions for canceling Gemini Advanced subscription

Gemini Advanced is a paid subscription from Google that gives you access to more advanced AI models. After signing up for the Gemini Advanced plan, if you no longer need to use it, you should cancel the Gemini Advanced plan, according to the article below.

Instructions for installing Windows 11 on a virtual machine, installing Windows 11 on VMware

Instructions for installing Windows 11 on a virtual machine, installing Windows 11 on VMware

In this article, WebTech360 will guide you how to install and experience Windows 11 on VMWare virtual machine.

How to group layers in Canva

How to group layers in Canva

Grouping layers in Canva makes your design more professional and also makes it easier to edit and work with your design.

Instructions for turning on communication safety to protect children using iPhone

Instructions for turning on communication safety to protect children using iPhone

Safe Communication will blur sensitive images received on your child's iPhone via Messages, AirDrop. Here's how to use Safe Communication on iPhone.

DTCL Season 14 Marksman Squad, DTCL Season 14 Marksman Build

DTCL Season 14 Marksman Squad, DTCL Season 14 Marksman Build

Marksmen return in TFT season 14 and are still a powerful class with outstanding long-range physical damage.

How to fix sound errors on Windows 10, fix Win 10 sound errors

How to fix sound errors on Windows 10, fix Win 10 sound errors

Some computers after upgrading to Windows 10 version have the problem of losing sound. We can check the audio device connections to the computer, or adjust the sound settings on the operating system.

How to use sounds in ScratchJR

How to use sounds in ScratchJR

In this article students will learn how to add sounds and use sounds in ScratchJR for each of their characters.

Instructions for learning English on ScratchJR

Instructions for learning English on ScratchJR

ScratchJR helps students create command-based programs for characters, and you can use it to build a foreign language learning program on ScratchJR.

How to create and manage iMessage iPhone chat groups

How to create and manage iMessage iPhone chat groups

The iPhone iMessage group chat feature helps us text and chat more easily with many people, instead of sending individual messages.

Instructions for setting nicknames for friends accounts on TikTok

Instructions for setting nicknames for friends accounts on TikTok

TikTok has an option to set a nickname for your friends' accounts to choose a name that is easier to remember in your friend list. This article will guide you to set a nickname for your friends' accounts on TikTok.

Guide to improving services and search in Edge

Guide to improving services and search in Edge

Search and service improvement is a setting in Microsoft Edge that lets the company use your web search data to improve your search and web experience.

Instructions to change Weibo password on phone, computer

Instructions to change Weibo password on phone, computer

Weibo accounts also have options to edit the account, such as changing the Weibo password. Here are instructions for changing the Weibo password.

How to write stylish text on Claude AI

How to write stylish text on Claude AI

Claude AI now allows you to choose from a variety of text writing styles so users get the text they need.

How to recover deleted messages on iPhone, recover iPhone messages fastest

How to recover deleted messages on iPhone, recover iPhone messages fastest

There are several ways to recover deleted messages on iPhone, using iCloud, using iTunes, and using third-party apps.