Windows open command prompt from directory

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.

  • 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.
Читайте также:  Reloaded windows no sound

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.

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.

Читайте также:  Драйвер wifi для asus x75a windows

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.

Need to navigate to a folder in command prompt [closed]

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

Closed 5 years ago .

My command prompt starts in C:\Users\ (Name) and I need it to be in a different folder, how can I do this using the command prompt itself?

6 Answers 6

Navigate to the folder in Windows Explorer, highlight the complete folder path in the top pane and type «cmd» — voila!

I prefer to use

because it requires no switches yet the working directory will change to the correct drive and path in one step.

  • also works with UNC paths if an unused drive letter is available for automatic drive mapping,
  • easy to go back to the previous working directory: just enter popd .

In MS-DOS COMMAND.COM shell, you have to use:

If by chance you actually meant «Windows command prompt» (which is not MS-DOS and not DOS at all), then you can use cd /d d:\windows\movie .

Just use the change directory (cd) command.

To access another drive, type the drive’s letter, followed by «:».

When I open a «DOS» command prompt, I use a batch file which sets all of the options I need and adds my old-time dos utilities to the path too.

The doskey line sets the CD command so that it will do both drive and folder simultaneously. If this doesn’t work, it is possibly because of the version of windows that you’re running.

Not the answer you’re looking for? Browse other questions tagged windows cmd or ask your own question.

Linked

Hot Network Questions

site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.4.16.39093

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Command prompt won’t change directory to another drive

I’m trying to compile some java (learning java currently), and to do so I need to change command-prompt’s directory (using javac).

It doesn’t change the directory. I try again using quotes:

Again it doesn’t change the directory. What am I doing wrong?

11 Answers 11

As @nasreddine answered or you can use /d

For more help on the cd command use:

Displays the name of or changes the current directory.

CHDIR [/D] [drive:][path] CHDIR [..] CD [/D] [drive:][path] CD [..]

.. Specifies that you want to change to the parent directory.

Читайте также:  Puppy linux ��� ubuntu

Type CD drive: to display the current directory in the specified drive. Type CD without parameters to display the current drive and directory.

Use the /D switch to change current drive in addition to changing current directory for a drive.

If Command Extensions are enabled CHDIR changes as follows:

The current directory string is converted to use the same case as the on disk names. So CD C:\TEMP would actually set the current directory to C:\Temp if that is the case on disk.

CHDIR command does not treat spaces as delimiters, so it is possible to CD into a subdirectory name that contains a space without surrounding the name with quotes. For example:

cd \winnt\profiles\username\programs\start menu

cd «\winnt\profiles\username\programs\start menu»

which is what you would have to type if extensions were disabled.

The directory you’re switching to is on another drive, you need to switch to that drive using :

then you can cd into the directory you want.

Use drive letter d for changing to D drive like:

When changing drives, you just need to type the drive letter, like d: (don’t use the backslash, like d:\; it doesn’t work).

You only use cd when moving between directories within the same drive.

The short answer

The correct way to go from C:\. \Admin to D:\Docs\Java drive, is the following command :

More details

If you’re somewhere random on your D:\ drive, and you want to go to the root of your drive, you can use this command :

If you’re somewhere random on your D:\ drive, and you want to go to a specific folder on your drive, you can use this command :

If you’re on a different drive, and you want to go to the root of your D:\ drive, you can use this command :

If you’re on a different drive, and you want to go to a specific folder on your D: drive, you can use this command :

If you’re on a different drive, and you want to go to the last open folder of you D: drive, you can use this command :

As a shorthand for cd /d d: , you can also use this command :

you should use a /d before path as below :

If you want to change from current working directory to another directory then in the command prompt you need to type the name of the drive you need to change to, followed by : symbol. example: assume that you want to change to D-drive and you are in C-drive currently, then type D: and hit Enter.

On the other hand if you wish to change directory within same working directory then use cd(change directory) command followed by directory name. example: assuming you wish to change to new folder then type: cd «new folder» and hit enter.

Tips to use CMD: Windows command line are not case sensitive. When working with a file or directory with a space, surround it in quotes. For example, My Documents would be «My Documents». When a file or directory is deleted in the command line, it is not moved into the Recycle bin. If you need help with any of command type /? after the command. For example, dir /? would give the options available for the dir command.

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