How to use Command Prompt, how to use cmd on Windows
Before Windows appeared, when we turned on a computer we would see nothing but a C:> prompt with a mouse pointer. It is known as the command prompt (or sometimes Dos prompt). In order for the computer to do the job, the user will have to enter cmd commands from internal memory.
However, this method of using a computer is really unattractive and some people even want to go back to using Dos prompt.
However, would you believe that the command line still exists on all versions of Windows? Why so? The reason is that commands are still a fast and powerful way to manage many aspects of Windows without having to use a complicated graphical interface.
As this article will show, the command line can be a useful tool for troubleshooting and testing, monitoring errors, and even improving security.
Still, we have to admit that command line commands are free tools; Although they are not always necessary, learning the basics also helps users discover the mysteries of the inner workings of Windows.
Before you get started, there are two things you should remember. First of all, this article is not for new users or those who are afraid of change. Second, back up your computer before doing: we are not responsible for any problems that arise when you use the command line.
What is Windows Command Prompt?
Before Windows appeared, the operating system called MS-Dos - shortened from Microsoft Disk Operating System - dominated the computer world. It will provide a connection link between the user and the computer hardware and is text-based, requiring only a keyboard to operate.
Technically, MS-Dos uses something like a command-line interface (CLI), while Windows exploits a graphical user interface (GUI).
Versions of the Windows operating system before XP require MS-Dos to operate because Windows itself cannot access the computer's Bios. BIOS is an abbreviation for the English phrase (Basic Input/Output System), meaning basic input and 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 essentially just an emulator of MS-DOS running inside Windows.
On the technical side, Command Prompt allows access to a few little-known tools and settings. Because it doesn't require graphics, Command Prompt is very fast and in some cases, it can be used to perform tasks that Windows cannot perform.
Of course, there are still a few drawbacks, not the least of which is the mysterious nature of the commands. Microsoft provides a comprehensive list of commands, how to use them, and a variety of options. Click here to get the list for Windows XP and click here to get the version for Windows Vista/7.
Command Prompt availability
Command Prompt is available on any Windows NT-based operating system, 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 enhanced command line interpreter available in recent versions of Windows, adds the ability to execute commands 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 best
Although Command Prompt is a powerful tool, we do not believe it is the easiest or best method for performing tasks. Some commands seem a bit complicated, possibly due to a long string of characters or too many parameters.
It's easy for errors to occur because users aren't paying attention when typing, so it's better to use Windows Explorer to manage files every day.
Besides, command line related tasks are also potentially dangerous – there are some ' No, Yes or Cancel ' confirmation dialogs and no Undo command (files deleted in Commpand Prompt cannot be recovered). from the Recycle Bin), so sometimes actions performed cannot be undone.
Unfortunately, using the wrong parameters and wrong files can also be overwritten - and can even damage Windows system files.
Get started with BIOS
Remember we mentioned Bios above? Although not strictly a command line tool, the Bios is a very important part of Windows and depending on the manufacturer and model of the computer, it can include some very useful security tools.
To find them, restart your computer, then press the Bios-specific key to access it – usually the F2 or Delete key . When the Bios screen appears, find the entry named Security and navigate to it using the arrow keys.
In most cases, there will be options to help users set a Supervisor password and a User password . If you set a User password, this password needs to be entered before Windows will operate (of course, Windows also has a password).
If you set a Supervisor password, this password needs to be entered before accessing the Bios – improving security.
Although there are ways to reset or disable these passwords, this technique is beyond the capabilities of most current techniques so they provide very useful additional security. For the same reason, users should be extremely careful when using these tools: forget your password and you could be completely locked out of your computer. So be careful.
Besides, look for the option named ' Boot Sector Virus Protection '. When this option is enabled, no software will be able to write to important boot sections of the hard drive like some viruses do. Note, though, that some software – specifically partitioning software – has good reasons for doing this. So be careful with fake notifications.
When finished, exit the Bios (usually using the Esc key ) and choose to save the changes you just made.
How to open the command line tool
Now run Windows to access the command line tool: you'll see it in the Accessories menu from All Programs in the Start menu . Or, users can use the Windows + R key , 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 this, right-click on the command line icon and select ' Run as administrator '.
Inside the dialog box
Command Prompt has some disadvantages. In Windows XP it starts up and displays the C:Windows folder (or 'directory', as it's often called in this environment) but in Windows Vista/7 it opens in the user's home address book ( C: Users[username ]) unless Administrator mode is used, as it opens in the C:Windowssystem32 address book . No matter where it is opened, this address book is considered a link.
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 change to another folder or path, the CD command is used – to change to an address book named C:My Directory , type cd c:My Directory and press Enter . To switch between drives, simply type the drive's wildcard name and a colon (e.g. D:) then press enter.
For most commands, type /? after it (or help before it) will display very detailed support information. ' Help ' will display a list of all available commands. When switching between commands, a / or – sign (minus sign) must be placed before it; check the support text to see which command to use.
Some special text characters are commonly used in the command line. The pipe character ¦ sends the result of a certain command for use 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,.
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 multiplication sign 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 account names, while net config workstation will display computer, user, and workgroup names.
More useful in terms of security, it is also used to prevent users from logging in at specific 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 rights (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 eliminate this habit. For example, to force each user to set a password that is at least 10 characters long and change his or her password within 90 days, type net accounts /MAXPWAGE:90 /MINPWLEN:10 .
Users who use a password that is too short will be notified that they need to create a new password the next time they log in. To remove this restriction, type net accounts /MAXPWAGE:unlimited /MINPWLEN:0 . (pay attention to the space after 'accounts).
Windows also has a built-in Guest account, without a password it cannot be changed in Windows. Although this account is not enabled by default, its password protection contributes to increased 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 entry screen appears. Besides, this command can also be used to change or remove the password of any user by replacing guest with the username that needs to be changed.
Copy securely and back up faster
Although 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 variety of tasks and it is even more reliable than using Windows Explorer.
For new users, xcopy can copy an entire folder or hard drive, including all hidden files, to a new storage area. 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 secure way to back up.
There are still many other uses users can use with xcopy – to copy hidden files (or system files), use the /h switch , and to copy only files that already exist in one location, use / u switch .
When using address book names, users will have 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).
Look for suspicious activities
So far, we've been looking for ways to use the command line to improve security and make certain tasks faster and safer. 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: this software is responsible for each connection displayed in the Proto column .
The Foreign Address column will display the URL or IP address of the remote home site (details of any IP address can be captured from an IP checker website or with the Sysinternals 'whois' tool).
Meanwhile, the Windows boot record creation tool provides a powerful way to find faulty or fraudulent drivers and services, such as services/drivers that install malicious software (spyware, viruses,.). It does not specifically require the use of command instructions but understanding how the command line works makes it easier for the tool to read and translate 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 select Enter to continue).
Once Windows is up and running, open a command line window as administrator 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.
All drivers in load order, repeating the full path, will be listed – and this information is much more useful when the concept of address book paths (stated above) is adopted. But how does this help in terms of security?
If your computer is working normally, save this log file somewhere for future comparison when 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 starts, the results will be added 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 indicate new drivers or services with suspicious activity: compare the previous boot-log file (ntbtlog.txt) with the most recently created file.
Run Windows software using the command line
Nearly all Windows software can be started using the command line. This may sound a little crazy, but it's actually very useful.
Many command line support software can enable or disable certain features, whether for convenience or for problem solving and security purposes. The recipe is to use the start command, followed by the name of the software. 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 .
Besides, to discover the software name of an application, right-click its entry in the All Program menu and select Properties . Search the Target dialog box to find file names with the .exe extension.
You may be disappointed, but there is actually no easy way to discover the transfer command for a particular software. If the software manufacturer doesn't provide the information on their website, try searching online for ' command-line options ' followed by the name of the software.
Fight infection
Similarly, ongoing Windows tasks are also listed when users use the tasklist command. This command will display the running applications and the amount of memory they are using. This is also a very useful way to detect malicious software – they can operate without your knowledge.
Use tasklist /svc to list the services associated with each software. 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 is a special Safe Mode option that can load the command line instead of Windows Desktop, which is very useful if malware has disabled graphical Safe Mode (some fake antivirus software does this to making it difficult for users to remove). In the Advanced Options menu, select Safe Mode With Command Prompt .
One application for this is to run System Restore. From the command window, type cd %windir%system32restore .
After pressing Enter , execute the rstrui.exe command to run the System Restore wizard. To run Windows Desktop, type start explorer . To shutdown a computer with a command, use shutdown -s to shut it down or shutdown -r to restart it.
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
If you prefer bold and larger fonts for your Command Prompt, you can change the font type and size.
To change CMD font type and size:
1. Open the Font tab in the Properties window .
2. In the Size section , select the font size you want to set as default. You can go down to 5 pixels and go up to 72 pixels.
3. Next, choose the font type you want to set for CMD. Microsoft recommends using True Type fonts on high DPI screens 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
If you don't like the default CMD window position or screen buffer size (visible frame on the screen), 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 the amount of content you can view. Leave the default option as is if you're not sure what size is right.
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
You can also customize the Command Prompt's background and text colors, whether you want to make it easier to read or simply look better.
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 command
You can use the color command to change the background and text color of the Command Prompt without changing the default settings. Here's how to do it.
1. Open Command Prompt and enter the following command to get available color properties:
color /?
2. The color attribute is specified by two hex digits - the first corresponds to the background; The second digit is the foreground. You can choose any color from the specified value as long as the background color and text color 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 the Command Prompt window transparent
If you're tired of Command Prompt's default blank interface, you can make it transparent. This not only allows you to maximize screen space but also add rich wallpapers from your desktop or applications.
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 sliders to achieve the best look.
4. Click OK to save the changes.
Additionally, 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 only for active sessions.
Customize Command Prompt using Terminal settings
The Windows 10 May 2019 Update added new experimental console features, including the Terminal tab. This allows you to customize and change the cursor shape, color, etc. 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 red, green, and blue color settings to select 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 inverse color of the cursor 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
If you want to dig deeper, you can customize other Command Prompt property sets using the Options tab. It includes options to change cursor size and Command History to increase or decrease buffer size and number of buffers.
In the Edit Options section , you can enable or disable Quick Edit Mode, Insert Mode , Ctrl shortcut , filter clipboard content 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 vibrant background, these settings will help you give Command Prompt the makeover it deserves.
Conclude
In this article we have shown you how to explore the 'underworld' of Windows to help improve your computer's security as well as perform a few tasks. It may sound a bit outdated 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 later when wanting to prevent or solve security-related problems.
See more:
You should read it
- Sub-commands in nslookup Windows command (Part 2)
- Sub-commands in the nslookup Windows command (Part 1)
- Sub-commands in nslookup Windows command (Part 3)
- Command at in Windows
- Set command in Windows
- Del command in Windows
- 10 useful commands in Windows you should know
- How to use the option equivalent to the 'ls' command in Windows
- The command reg add in Windows
- Rem command in Windows
- Instructions for using Command Prompt
- Rd command in Windows
Maybe you are interested
How to use the file search command on Windows, find saved files
Why is tldr command better than man command in Linux?
Should I use PowerShell or Command Prompt?
What to do when open command window here does not appear?
How to switch users on the Linux command line
How to fix Mac Homebrew error 'zsh: command not found: brew'