How To Open A File From The Command Line

Table of contents:

How To Open A File From The Command Line
How To Open A File From The Command Line

Video: How To Open A File From The Command Line

Video: How To Open A File From The Command Line
Video: How To Open a File from the Command Prompt In Windows 10/8/7 [Tutorial] 2024, March
Anonim

For some reason, you can't open the file through the explorer or file manager? There is always the good old command line. It remains only to master the commands that are used in it for certain operations.

How to open a file from the command line
How to open a file from the command line

Instructions

Step 1

First, go to the command line itself. To do this, in Windows XP, click the "Start" button, then "Run" and enter "cmd" there. In Windows 7 - the "Start" button, enter "cmd" in the search field, right-click on the result that appears and select launch as the computer administrator. When prompted to launch, click Yes.

Step 2

Now you need to find the directory where the problem file is located. Initially, you are in the "C: Windowssystem32" system directory. To view the contents of a directory, type "dir / p" ("p" is responsible for page-by-page browsing) and the computer will give you a list of files and subdirectories, to go to the next page press the Enter button. In Windows 7, "p" is optional, as this OS has the ability to scroll through the contents of the command line. To display only directories, use the "/ ad" ("dir / ad") key, only files - the "/ b" ("dir / b") key.

Step 3

To switch to another directory, use the "cd" command (for example, by typing "cd C: Windows", you will be taken to the Windows directory, from the initial directory you can also get there with the "cd.." command, which serves to go one level back) … If you need to change the drive - enter ":" (for example "D:").

Step 4

Now that you have found the directory, and the file you need in it, you just need to enter the name of this file. The file will open using the program, which, according to the specified parameters, should open it. In the future, it is not necessary to go to the directory with the file every time, you just need to remember the full path to it (see the image for the step).

Step 5

For frequently used commands, it is customary to create bat-files in which all commands are written in advance. To execute a bat file, you just need to run it. Such files can be made universal (for example, to copy not only specific files, but any).

Recommended: