How to use the Command Prompt

How to use the Windows Command Prompt

As I have already mentioned in the opening bars of this guide, the Command Prompt Windows is the tool included "standard" in the Microsoft operating system, which allows you to act on the latter by manually giving the necessary instructions, without the aid of the mouse. You can think of the Command Prompt as some kind of evolution of MS-DOS, one of the first operating systems released by the Redmond giant, which worked just like this: the user was required to manually type the commands, instructions and programs to start, without the aid of windows and icons (which, instead , today we are used to doing).

The commands supported by the Windows Prompt are so many and allow you to reach the most disparate purposes, from the display of basic information to the modification of delicate parts of the operating system; it is for this reason that, as I will often repeat to you throughout this guide, this tool should be used with extreme caution, to avoid causing unintended damage to data or to the entire operating system: never forget that!

That said, it's time to explain how to use the Command Prompt Windows: In the sections to come, I'll walk you through the simplest methods of accessing it, give you an overview of the most important (and harmless) commands, and then explain how to open Command Prompt directly in a folder and how to use it with privileges. elevated (or in mode CEO).

Launch Command Prompt

To use the Windows command line, you must necessarily start the Command Prompt by opening the appropriate window: you can do this in a large number of ways, depending on what your needs are. Below I list the ones that, in my opinion, are the most practical.

  • Start Menu (Windows 10) - click on the button in the shape of pennant located in the lower left corner of the screen, access the folder Windows system and click on the icon Command Prompt.
  • Start Menu (Windows 8- presses the button Home and, once inside the Start Screen, move the mouse slightly and press the button (↓), located at the bottom left, to access the section All apps. Finally, identify the box Windows system and select the icon Command Prompt.
  • Start Menu (Windows 7) - open the menu Home and click on the items All programs Accessories; finally, he presses on the voice Command Prompt which is displayed on the screen.
  • Run window - press the key combination Win + R, type in the command cmd and press the button Submit of the keyboard.
  • Cortana (Windows 10) - click on search bar or onCortana icon (The white circle) located next to the Start button, type the word Prompt in the appropriate box and presses on the result most relevant to the program you are looking for.
  • Power menu (Windows 8.1) - right click on the button Home (or press the key combination Win + X) and select the appropriate item from the menu that appears.

For more information on how to open the Command Prompt, I invite you to refer to my specific tutorial on the subject.

Main commands

If you have had the need to start the Command Prompt, it is very likely that you are following some guide, perhaps taken from my site, in order to achieve a specific purpose. Otherwise, if it is your intention to familiarize yourself with this tool, then I recommend that you start with a few simple commands which, in most cases, are completely harmless.

  • cd "path and folder name" - enter a folder;
  • dir - displays the files contained in the current folder or in the one specified as an argument;
  • tree - displays the files contained in the current (or specified) folder in the form of a “tree”, including any sub-folders;
  • chkdsk - performs a scan of the current (or specified) disk. This command must be run in administrator mode;
  • data - show (and possibly modify) the current date;
  • time - show (and possibly modify) the current time;
  • start ProgramName - start the specified program in an independent window;
  • tasklist - shows the list of active processes on the system;
  • title NewTitle - gives a title to the Prompt window;
  • see - shows the version of the operating system in use;
  • hostname - show the device name;
  • exit - exits the Command Prompt.

You can find the complete guide to the commands that can be used in the Prompt directly in the official Microsoft guide (in English). I want to remind you, once again, that the Command Prompt is an extremely powerful tool, therefore it should be used with caution and only when you are well aware of what you are doing: I warned you!

How to open Command Prompt in a folder

Do you need to quickly open the Command Prompt in the folder you are in, so that you can directly act on the files it contains? No problem, you can do it quickly with a click of the mouse.

How? Very simple: first, move to the folder of your interest using File Explorer / Windows Explorer, then right-click on an empty spot on it while holding down the key Shift on the keyboard and select the item Open Command Prompt here give the menu that you come purpose.

If you are on Windows 10, you will see the option instead Open PowerShell window here: don't worry, you can issue the same commands you need in the PowerShell window too (a “boosted” Prompt, which I'll talk about later), as the result is exactly the same.

How to use the Command Prompt as an Administrator

If you need to get elevated privileges via the Command Prompt, to act, for example, on certain system folders, you must necessarily use Command Prompt as Administrator, invoking it with elevated privileges. You can do this in different ways: below I will list the quickest.

  • Windows 10 - open the menu Home, go to the folder Windows system and right click on the Command Prompt. Then select the items More> Run as Administrator from the proposed menu and then click on the button Yes. Alternatively, press the key combination Win + R, type in the instruction cmd.exe and confirm the entry by pressing the keys Ctrl + Shift + Enter of the keyboard.
  • Windows 8.1 - right click on the button Home and select the item Command Prompt (Administrator) give the purpose menu.
  • Windows 7 - open the menu Home, click on the items All programs Accessories, right click on the icon Command Prompt and choose the item Run as administrator from the proposed menu, confirming the will to proceed by pressing the button Yes.

Keep in mind that, although the instructions are practically the same that can be given from the "simple" command line, the Command Prompt in Administrator mode allows you to act undisturbed on sensitive areas of the operating system, such as protected files and other sensitive areas. So, act fully aware of what you are about to do: a single wrong command could make the entire computer unusable. Don't say I didn't warn you!

How to use Windows 10 Command Prompt (PowerShell)

For your information, Windows PowerShell is the most “modern” and functional version of the command line, introduced by Microsoft starting from Windows 7 and based on .NET framework.

In addition to integrating the commands already available in the Prompt, PowerShell provides for the use of more "advanced" procedures dedicated to the management of delicate aspects of the operating system, both locally and remotely, as well as to customize and automate numerous operations, allowing the user to create their own commands and scripts using the C # programming language.

The easiest way to start PowerShell is to open the menu Home Windows and type the name of the program in the search field, selecting the first result returned. Alternatively, you can press the key combination Win + R and type in the command powershell, I follow the pressure of the tasto Submit.

Again, if you are on Windows 10, you can launch PowerShell by right clicking on the button Home and selecting the voice Windows PowerShell (simple or administrator) from the proposed menu: in short, the techniques to invoke the program are not lacking at all!

As I mentioned earlier, PowerShell windows allow you to issue all commands compatible with the Prompt, along with many other directives useful for managing the system. Here are some commands you can use to familiarize yourself with PowerShell.

  • Get-Help (commandName) - displays a help page relating to the command indicated.
  • Get-Item (SearchParameter) - returns all items in a given folder that match the specified parameter.
  • Copy-Item - is the command that, with the right parameters, allows you to copy files, folders and objects in general. When used in a certain way, it allows you to copy multiple objects at the same time.
  • Get-Content (filename) - is the command that allows you to retrieve the contents of a file, preferably text, without opening it.
  • Start-Process e Stop-Process - these commands, respectively, allow you to start and stop processes.
  • Get-Process - displays the list of all active processes on the system.
  • Invoke-Command (CommandName) - allows you to execute a command or script; it is usually used for managing remote servers.

For more information about PowerShell and its commands, I invite you to refer to the official guide made available by Microsoft.

How to open the "command prompt" on Mac

Wait, you are telling me that you did not find the information I gave you in the course of this tutorial useful, as you own a Mac and do you need access to the command line tools of the same?

What you are looking for, then, is the terminal: for your information, this is a program through which you can interface with MacOS by issuing manual commands, as well as executing programs by specifying particular parameters.

The Terminal is an extremely powerful tool that must be used with great caution: one wrong command is enough to damage personal files or, even worse, the entire operating system. Keep this aspect in mind during its use and be careful to issue only commands for which you know the exact result.

However, starting the Terminal is very simple: first, open the Launchpad macOS by clicking on the icon in the shape of rocket attached to the Dock bar, presses on the folder Other and click on the terminal residing within it.

Alternatively, you can start the Mac command line by going to the menu Or> Utility of Finder (or by using the key combination cmd + shift + u) and selecting the icon terminal from the folder that opens next.

Again, you can access the program by searching for Spotlight: press, therefore, on the icon in the shape of a magnifying glass located in the upper right corner, type the word terminal in the search area and click on the first result obtained (the one identified by the wording Best). If you love to contact CrabFinally, you can ask her to open the Terminal for you by giving a voice command.

As for the available commands, they are really many and vary according to the usage scenario: as I explained to you at the beginning of this section, the Terminal can also be used to start certain programs with particular parameters. Below I give you a list of the most commonly used commands, accompanied by a brief explanation.

  • cd "path and folder name" - enter a directory;
  • cd ~ - enter the user's Home folder;
  • cd / - enter the macOS root folder (handle with care!);
  • pwd - shows the folder in which you are working;
  • rm filename - delete a file;
  • mkdir folderName - create a new folder with the name “folderName”;
  • rm -R folderName - delete the folder nomeCfolder and all its contents;
  • ls -alh - shows a detailed list of the files in a folder, displaying hidden files;
  • top - shows the list of active processes on the system;
  • open "path and file name" - open a file;
  • man commandname - shows a short guide about nameCommand.

If you remember well, you have already encountered these commands on my blog: I have in fact told you about them in some guides that I have dedicated to the Mac, for example the one to view hidden files, to delete undeletable files or to change the creation date of a file.

Anyway, the Mac Terminal command list doesn't stop there, it's nothing short of… boundless! By renewing the invitation to act carefully, you can try a quick Google search to get more information on this.

How to use the Command Prompt

Audio Video How to use the Command Prompt
add a comment of How to use the Command Prompt
Comment sent successfully! We will review it in the next few hours.