Working with files on the command line

Help command line is indispensable for computer malfunction. Getting skills is usually associated with work, how to open, copy, run, delete a file. How the algorithm of actions will look at each of the components of the work, you can see below. Let's start with the question of how to open a file via the command line, then show how to start the programs, delete them, copy a piece of text. A novice will cope with these tasks, but it has been useful for a long time to work with a computer to recall or study these options for carrying out ordinary processes.

In the Windows command line, you can fully work with files.

Open files

Sometimes through the Manager, Explorer can not open files, then the command line will help you. You will only need to remember a few commands.

So, you started the program, you want to open one of the documents. Follow this algorithm.

  1. Find the directory where your file is located. At startup, you are in drive C, in the Windows / system directory
  2. The command that allows you to see what is included in the directory is dir. For paging, add “/ p”. After you confirm the execution of commands, a list will open with the contents of the folder.

  3. To go to the next page, press Enter.
  4. If it is necessary that only subdirectories are reflected in the list, the key “/ ad” is added to the command, “/ b” is displayed to display only files.
  5. To go to another folder, enter the path to the folder in the cd string. For example, the entry might look like this: “cd C: \ Windows”. So, you will step out of system32, where you find yourself in the Windows folder by default, thereby going back one level.

  6. Going to the desired directory, enter the name. The document will open in the program in which it should open by default.

In the future, remembering the path, in order to execute the launch, you will not need to go to the directory, just enter the full path in the line immediately.

TIP. For speed of work there are bat-files, they pre-enter the commands necessary, often dialed. Then this file is launched, and it will open the necessary program.

Run, close programs

Consider how to run the file from the command line, if it is a program. It will matter here if the application is included in the Windows package or if you need a third-party application. If the application being opened is part of the Windows components, the launch is performed by entering its name in the console, then pressing Enter. You do not need to specify an extension. Suppose you needed to launch Notepad, then simply type the word notepad, then press Enter.

If the program is third-party, you should enter the full path to it. For example, you need to run WinRAR archiver, which means that you enter the following:

C: \ Program Files \ WinRAR \ WinRAR.exe

Write the path in quotes if there are spaces in the address to it. Quotation marks are needed while direct - not in the form of commas. If the quotes are incorrect, the program will not open. The quotes do not need to be copied, they are typed directly into the command line, without using the clipboard. On the English keyboard layout, the necessary quotes are in the Shift + E key combination.

TIP. If you go to the directory with the program, you do not need to prescribe the full path to it. Simply enter the file name with the extension. For example, going into the WinRAR directory, entering the WinRAR.exe command will launch the program.

To close an application, use the taskkill program. First, type the tasklist, for you to see a list of processes will be released. Enter the indicator number in the command, for example, “taskkill / pid 3900 / f”, to confirm, press Enter. 3900 is the ID number.

Search by extension

The command line will help you find the file you need by its extension, if you do not remember its exact name. To find the file through the command line, you need to remember the command used in this case. Type dir and the extension you need through an asterisk. Suppose you are looking for one of the executables, then typing:

dir * .exe

All files with this extension will be displayed on the screen, you will only have to find the one you need among them. If you want to search in subdirectories, add the key "/ S". The full command to search for a file in drive C, including a search in subdirectories, will look like this:

dir C: *. exe / S

Deletion

Delete unnecessary system files are also possible through the program in question. Delete the file through the command line is easy. To delete, use the del command. After it is prescribed the path to the desired document. For example, you want to delete 123.txt. Enter the following: "del C: \ Windows \ 123.txt".

IMPORTANT. For a complete cleaning of any folder, the “/ S” attribute is used. You can delete with the key any subdirectories, all data.

Copy text

OS Windows, taking care of speeding up, simplifying work on a PC, created hot keys - combinations that allow you to quickly copy text, paste it into another file. This combination of Ctrl + V or Shift + Insert.

It does not work on the command line. To copy the information in it, you must first configure it.

  1. Press the combination "Alt + Space (space) + Q". A window with command line properties will open.

  2. Go to the tab "General", in the group "Edit", tick the item "Quick Insert". And also you need to activate the "mouse selection".

  3. By clicking OK to confirm the action, you will see several options for this function. Check one box, click OK.

Now, to copy a piece of text from the command line, select it with the mouse, press Ctrl + C.

All these skills will be useful to you if you can not perform the desired process in the usual way due to failures, problems with the computer. Simple actions, easy to remember algorithm, clear instructions - everything helps you more professionally solve the questions posed. You just need to remember the list of commands, follow the rules for entering them (for example, when you need to put quotes and which ones), clearly, accurately enter the path to the required file.