Windows open file from command prompt

Find and Open Files using Windows Command Prompt

Finding and opening the files through windows explorer is simple but it takes some time. There is a faster way to achieve the same using the command prompt. Working through the command prompt is the quickest way to get things done. Through the command prompt, you can find things quickly and allows you to open the files right there.

Search a file in Windows Terminal

Type cmd in the search bar of your Windows 10 computer. From the results, click on the command prompt to open it. Type the following line in command prompt window:

Replace the search term with the file name that you want to search.

I will describe a little what the terms in the command actually means.

  • Dir — It is used to list the list of files and subfolders contained in a folder.
  • \ — It is used to tell dir to search from the root directory of the current drive.
  • * — It’s a wildcard character. if used before a name (e.g *data), will search for text that ends with that specific name data. If used after a name(e.g data*), will search the text starting with the name data.
  • /s — It is used to tell dir to search from all sub-directories

For instance to search a file name “data set”, I will enter”

It will list file names starting with name screenshot3 along with its directory.

Open a file from Windows Terminal

After you find the file you want to open, you can launch it without navigating through windows file explorer.

In a command prompt window, type cd followed by the path of the file that you wish to open. After the path matches with the one in the search result. Enter the file name of the file and press Enter. It will launch the file instantly.

By following the above method, you can easily search and open a file using command prompt as it is a quick way of accessing any file as compared to windows file explorer.

Find and Open Files Using Command Prompt in Windows 10

Do you ever drive yourself crazy looking for all the files you need for a project? Have you saved them in unknown places on your computer? Can you only remember part of the name you gave the file? If any of these apply to you, using the command prompt instead of Windows Explorer may help you quickly find the files you need and allow you to open them directly from that location.

We have to mention, though, that it’s a waste of time using the Command prompt to open simple, trivial files. However, this method is something you should definitely look at when dealing with multiple files and assorted file types in random folders.

Opening Command Prompt

To search for the files you want, first launch Command Prompt. There are several ways to do this.

  • Type cmd in the Windows search box, then click on the icon to open the window. It’s preferred to run the command prompt as an administrator.
Читайте также:  Ms sys ��� linux

  • Use the Run window. A fast way to launch this window is to press the Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter or click OK.

  • Use Cortana if it works for you properly: as soon as you see the Cortana is “listening” text, say “open command prompt,” and it will open up.

Search for your files

In the command prompt, type dir «\search term*» /s , but replace the words “search term” with text you want to find by using the file name. In the following screen, we are trying to search for a folder/file named “movies.”

The correct file path can be easily identified by the size of the folder. Once you have typed in the command, press Enter, and the search begins. It may look like nothing is happening for a second or two, though. But soon all the file paths mentioning the correct file or folder will be identified and named.

What do all the terms in the command mean?

  • dir is a command used to show files in the current directory but which can also locate data anywhere in the system.
  • The backslash tells dir to search from the root directory of the current drive.
  • /s tells dir to search all subdirectories.
  • Finally, * is used by command-line apps as a wildcard. It indicates that the search will locate all file names that contain your search term.
  • Putting an asterisk at the end of the name, like business* , will find all the files with your search term at the beginning of the name.
  • If you put it at the beginning, then your search will include only results with your text at the end. For example, *.jpg .
  • If you put an asterisk at each end of the search term, you will cover all the bases. No matter where your text is in the actual name of the file, that file will be listed in the results.

Change Command Prompt Directories for Precise File Location

If your target file is located in D: drive, you won’t find it anywhere in the Windows folder from the C: drive. Therefore, you should learn to change the drive path as shown below.

First, type cd.. , which will enable you to easily move one folder up. To go to D drive, just type d: , and the command prompt will now listen to the new drive.

Within the destination drive, you can search for the correct file once again using the dir «\search term*» /s command discussed in the previous section. Do take care to use the * wildcard, both at the beginning and end of the search term for a comprehensive search – especially if that folder has hundreds of files. It’s pretty common to make mistakes in the wildcards and backslash, which returns a “no label” error as shown below. If you type correctly, you will easily identify the folder path and the correct file name.

If the folder path is very long, you may want to copy-paste the entire thing. We have a detailed tutorial on how to cut-copy-paste in the Windows 10 command prompt. But the method is simple enough: use Ctrl + A to select the entire command prompt screen, then just release the mouse or trackpad click. This would make any part of the command screen selectable for a copy-paste action as shown below.

Open your Files in Windows 10 Command Prompt

Once you find the file you want to open, you can open it from this screen using its default program, without locating it in your file explorer.

First, change the directory to the immediate folder where the file is located. This can be done using cd followed by the entire folder path to the correct file. It’s common to make mistakes, so it’s better to copy-paste the entire folder path as discussed in the previous section. Once the correct directory menu has been opened, you can open any files there. Here it’s a folder, where I saved my personal collection of rented movies.

Читайте также:  Install requirements python windows

Enter the file name inside the quotation marks «..» as shown here. Press Enter and the file will open using its default application. Here it’s Movies and TV programs, which is set as my default application for .mp4 files.

The file, a Mel Gibson-led movie called “Get the Gringo,” opens from the command prompt.

You can open multiple files from the command prompt once you’ve opened the correct folder. Here we open another file called “Erin Brockovich.mp4” in the same folder.

The file, a Julia Roberts-led movie called “Erin Brockovich,” opens from the command prompt using the default app.

Once you’re done, you may want to move back to another folder in the command prompt. For this, use cd.. followed by a new drive name as shown below. Navigating your computer’s files using the command prompt is very similar to just doing it in a regular way from your File explorer.

Wrapping Up

If you are looking for all your files concerning one topic or just trying to find the one that is hiding among all the folders in your computer, try using the command prompt. It may make it more efficient for you.

Amazingly, the command prompt is way faster and more responsive than opening the files from the File Explorer. This is true for video files, Windows Photos, Word documents, and heavy-duty games. The reason for this is that the GUI always consumes more memory and slows down the processes.

Related:

Sayak Boral is a technology writer with over ten years of experience working in different industries including semiconductors, IoT, enterprise IT, telecommunications OSS/BSS, and network security. He has been writing for MakeTechEasier on a wide range of technical topics including Windows, Android, Internet, Hardware Guides, Browsers, Software Tools, and Product Reviews.

How to open a file / folder in Command Prompt [CMD guide]

  • The Command Prompt is a handy command-line utility with which you can open folders and files.
  • This how-to guide provides guidelines for how you can open folders and files with the Command Prompt.
  • The How to hub includes links to a plethora of how-to guide articles for Windows software.
  • Don’t hesitate to learn more about this subject by visiting our dedicated Command Prompt webpage.

Microsoft DOS (Disk Operating System) is a command-line platform that was the world’s foremost operating system during the 1980s.

However, DOS declined into irrelevance during the 1990s after Microsoft released Windows 95, which introduced the Start menu.

Nevertheless, Windows has retained a windowed replica of DOS in the form of the Command Prompt. That’s not entirely the same as the 1980s DOS platforms, but it has a similar command set.

You can open folders and files with the Command Prompt instead of File Explorer. This is how you can open folders and files within the Command Prompt.

How can I open files and folders with the Command Prompt?

1. Open the Command Prompt

  1. Open the Type here to search tool by pressing the Windows key + S hotkey.
  2. Enter the keyword Command Prompt in the search utility.
  3. Click Command Prompt to open it.
  4. You can also right-click Command Prompt and select Run as administrator to open it with admin rights.

2. Open a folder

  1. First, enter cd / in the Command Prompt, which will return you to the root C: drive.
  2. Then you can open a folder in the Command Prompt by entering this change directory command:

You’ll need to include the root folder and all its subfolders within the path to open a required folder within the Command Prompt.

  • Press the Return key after entering the change directory command.
  • To display a folder’s file content within the Command Prompt, type dir and press Enter. Then the Command Prompt will display a file and subfolder list for the folder.
  • 3. Open a file

    Alternatively, you can open files in the Command Prompt without moving to their folders first. To do that, you’ll need to enter a command that includes the full folder path for the file along with the file title itself.

    For example, let’s suppose you need to open a file titled youcam_9.png from the path Users\mav_u\pictures. To do so, you would enter this command:

    Читайте также:  Графический интерфейс windows назначение

    That file-opening command must always include quotation marks.

    So, who needs File Explorer when you can open folders and files with the Command Prompt instead?

    Ok, the Command Prompt may not be everybody’s cup of tea; but some users might still prefer its command-line flexibility.

    How to open a File or Folder using Command Prompt or PowerShell in Windows 10

    Thanks to the graphical user interface of Windows 10, users can get just about anything done by simply clicking on the icon. Without the GUI, we’d have been forced to do everything from the command line in PowerShell or Command Prompt.

    However, learning to work with the command line is a useful skill, as it gives you quick access to functions and operations. For instance, in some situations when working on Command Prompt or PowerShell, you need to open folders or files. You don’t have to exit the window just to find the folder or file.

    Open folders & files using Command Prompt & PowerShell

    In this guide, I’ll show you how to open folders right from Command Prompt and PowerShell on your Windows 10 PC.

    What you will learn:

    1. How to navigate to a folder using Command Prompt and PowerShell.
    2. How to open a folder using Command Prompt and PowerShell.
    3. How to close a file using Command Prompt and PowerShell.

    In the post remember to replace with your username.

    1] How to navigate to a folder using Command Prompt and PowerShell

    Open the Command prompt by searching for cmd in the Start Menu and selecting Command Prompt. For PowerShell, you can also search for it and open from the Start Menu.

    Type in the following command and hit ENTER to run it:

    NOTE: In the above command, replace Path\To\Folder with the actual path to the folder that you want to open. So, it can become:

    To open a file saved in this folder, input the name of the file and press ENTER. Example,

    Alternatively, you can enter the full path to the file without using the cd command. For example,

    2] How to open a folder using Command Prompt and PowerShell

    The first technique would open a file saved in a folder. However, if you wish to open the folder in File Explorer using Command Prompt or PowerShell, you make use of the start command.

    Command Prompt

    To open a folder, append the folder path after the start command. For example, I can navigate to the New Folder folder using the following command:

    If you want to open the current folder, run the start command with a fullstop (.):

    To open the parent folder to your current folder, use two fullstops (..):

    On hitting ENTER, the specified folder will open in a File Explorer window.

    PowerShell

    To open a folder in File Explorer using PowerShell, input either of the following cmdlets –

    and add the path to the folder.

    To open the current directory, use the following command:

    3] How to close a file using Command Prompt and PowerShell

    To close an already opened file using the command line, you make use of the taskkill command. First, navigate to the folder using the first method:

    Enter the following command when you are in the correct directory:

    In the above command, replace the filename part with the name of the file you want to close.

    Note that this command closes every instant of the open file, and you risk losing unsaved data.

    I hope you find the post useful.

    Date: September 17, 2020 Tags: CMD, PowerShell

    How to uninstall a program using Command Prompt in Windows 10

    How to remove virus from USB Flash Drive using Command Prompt or Batch File in Windows 10

    How to use PowerShell to find and disable Webcams in Windows 10

    [email protected]

    Keshi Ile is a Windows enthusiast who loves to write How-to’s, Gadget & software reviews, and tech tutorials. He has also managed SEO teams that grew businesses from zero traffic to authority status.

    Оцените статью