On Mac OS X and GNOME on Linux, there are commands that can be used to open files from the command line in their associated GUI editors: open
and gnome-open
, respectively. Is there any command like this for Windows?
asked Feb 17, 2011 at 2:30
4
If you are currently in the command prompt and have a file called test.png
and , which are located in c:\test
you can do the following:
If you are at the directory (so should say c:\test>
) just type:
test.png
which would open test in the default png picture editor.
If the files name contains spaces, then simply enclose the file name within » «
"this image.png"
You can alternatively type:
c:\test\test.png
which will open the file no matter where you currently are.
Finally, you can pass the picture to another program. For example, if you have an image editor called imageedit.exe and it supports opening files through command lines (and if the program is pathed/accessible or you are in it’s current directory), you can type the following:
imageedit c:\test\test.png
answered Feb 17, 2011 at 2:38
William HilsumWilliam Hilsum
117k19 gold badges182 silver badges266 bronze badges
4
If it is a registered extension, you can use «start» as in
start WordDoc.doc
answered Feb 17, 2011 at 2:36
DennisDennis
6,5881 gold badge28 silver badges28 bronze badges
5
On Windows command-line explorer "<PATH>"
will open the file path with Windows default associated programs. This will also handle all URIs ( http:,https:,ftp: ) and other file protocols defined in Windows Operating System.
If the file or protocol is not associated with any program then an Open With
dialog will show up. If file is not present then default My Documents
folder will open up. It can also open executable files ( EXE, BAT files) and shell namespace paths.
Examples
explorer "http://www.google.com"
— will open http://www.google.com in windows default browser.
explorer "file:///C:\temp\"
will open temp directory if present
explorer "file.txt"
will open file.txt
on the current directory path .i.e. %CD%
path
explorer ::{645ff040-5081-101b-9f08-00aa002f954e}
will open RecycleBin.
You can refer about explorer’s other useful command-line switches here
oldherl
2031 silver badge8 bronze badges
answered Jul 7, 2017 at 18:17
lalthomaslalthomas
3172 silver badges9 bronze badges
The first parameter of Start is a window title, so if you have a space in the file name, and you type
Start «My File.txt»
you’ll get a command line window with «My File.txt» as the title. To get around this use a dummy title,
Start «my title» «My File.txt»
Depending on the file and what application is opened there probably won’t be a window to see anyway.
answered Jan 27, 2017 at 14:27
1
If you are in PowerShell
(at the PS (current-directory)>
prompt),
and you want to open a file in the current directory,
you may try this .\myfile.ext
.
If you are in the Command Prompt, you can accomplish the same result by typing
powershell -c .\myfile.ext
(You must include the .\
,
as PowerShell doesn’t load files from the current location by default.)
Or you can provide a directory name (relative or absolute)
if the file isn’t in the current directory.
For the first scenario — if you are in PowerShell —
if the filename contains space(s),
enclose it in quotes (either kind) and precede it with
the &
symbol:
PS C:\Users\myusername\Pictures> &".\funny cat.jpg"
(You may add a space after the &
for readability,
if you prefer readability, and you may use /
instead of \
.)
I don’t know how to make this work in the second scenario
(in which you are running powershell -c
from Command Prompt)
if the file or directory name contains space(s) — quotes don’t seem to help.
answered Oct 19, 2018 at 14:25
0
This may come a bit late, but the correct command for editing a file name in Windows 7 is «write file_name»
This should open up the default text editor and you should be able to edit the file easily
Edit: It seems to open only Wordpad. For me that was the default text editor.
answered Jul 31, 2014 at 18:11
CoderCoder
12 bronze badges
3
Specific executable with specific file:
Git Bash Script On Windows 10 :
SHORTCUTS_MAIN_START.sh :
FILE_PATH="C:\DEV\REPO\GIT\AHK03\SHORTCUTS\SHORTCUTS_MAIN.ahk"
EXEC_PATH="C:\DEV\REPO\GIT\AHK03\AHK_ROOT\AutoHotkeyU64.exe"
$EXEC_PATH $FILE_PATH
This example opens the file denoted by $FILE_PATH with the executable denoted by $EXEC_PATH. If this doesn’t work for you, try converting the single slash ( «\» ) into double slashes ( «\\» ) for the paths.
answered Sep 19, 2017 at 16:16
KANJICODERKANJICODER
3573 silver badges6 bronze badges
In the Windows command prompt, you can run
edit [file_name]
in order to view batch files/logs/text files etc. This command requires QBASIC.EXE
, which is by default present in Windows.
See here for other useful MS-DOS commands.
Dave
25.3k10 gold badges58 silver badges70 bronze badges
answered Sep 10, 2012 at 6:54
3
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
On Mac OS X and GNOME on Linux, there are commands that can be used to open files from the command line in their associated GUI editors: open
and gnome-open
, respectively. Is there any command like this for Windows?
asked Feb 17, 2011 at 2:30
4
If you are currently in the command prompt and have a file called test.png
and , which are located in c:\test
you can do the following:
If you are at the directory (so should say c:\test>
) just type:
test.png
which would open test in the default png picture editor.
If the files name contains spaces, then simply enclose the file name within » «
"this image.png"
You can alternatively type:
c:\test\test.png
which will open the file no matter where you currently are.
Finally, you can pass the picture to another program. For example, if you have an image editor called imageedit.exe and it supports opening files through command lines (and if the program is pathed/accessible or you are in it’s current directory), you can type the following:
imageedit c:\test\test.png
answered Feb 17, 2011 at 2:38
William HilsumWilliam Hilsum
117k19 gold badges182 silver badges266 bronze badges
4
If it is a registered extension, you can use «start» as in
start WordDoc.doc
answered Feb 17, 2011 at 2:36
DennisDennis
6,5881 gold badge28 silver badges28 bronze badges
5
On Windows command-line explorer "<PATH>"
will open the file path with Windows default associated programs. This will also handle all URIs ( http:,https:,ftp: ) and other file protocols defined in Windows Operating System.
If the file or protocol is not associated with any program then an Open With
dialog will show up. If file is not present then default My Documents
folder will open up. It can also open executable files ( EXE, BAT files) and shell namespace paths.
Examples
explorer "http://www.google.com"
— will open http://www.google.com in windows default browser.
explorer "file:///C:\temp\"
will open temp directory if present
explorer "file.txt"
will open file.txt
on the current directory path .i.e. %CD%
path
explorer ::{645ff040-5081-101b-9f08-00aa002f954e}
will open RecycleBin.
You can refer about explorer’s other useful command-line switches here
oldherl
2031 silver badge8 bronze badges
answered Jul 7, 2017 at 18:17
lalthomaslalthomas
3172 silver badges9 bronze badges
The first parameter of Start is a window title, so if you have a space in the file name, and you type
Start «My File.txt»
you’ll get a command line window with «My File.txt» as the title. To get around this use a dummy title,
Start «my title» «My File.txt»
Depending on the file and what application is opened there probably won’t be a window to see anyway.
answered Jan 27, 2017 at 14:27
1
If you are in PowerShell
(at the PS (current-directory)>
prompt),
and you want to open a file in the current directory,
you may try this .\myfile.ext
.
If you are in the Command Prompt, you can accomplish the same result by typing
powershell -c .\myfile.ext
(You must include the .\
,
as PowerShell doesn’t load files from the current location by default.)
Or you can provide a directory name (relative or absolute)
if the file isn’t in the current directory.
For the first scenario — if you are in PowerShell —
if the filename contains space(s),
enclose it in quotes (either kind) and precede it with
the &
symbol:
PS C:\Users\myusername\Pictures> &".\funny cat.jpg"
(You may add a space after the &
for readability,
if you prefer readability, and you may use /
instead of \
.)
I don’t know how to make this work in the second scenario
(in which you are running powershell -c
from Command Prompt)
if the file or directory name contains space(s) — quotes don’t seem to help.
answered Oct 19, 2018 at 14:25
0
This may come a bit late, but the correct command for editing a file name in Windows 7 is «write file_name»
This should open up the default text editor and you should be able to edit the file easily
Edit: It seems to open only Wordpad. For me that was the default text editor.
answered Jul 31, 2014 at 18:11
CoderCoder
12 bronze badges
3
Specific executable with specific file:
Git Bash Script On Windows 10 :
SHORTCUTS_MAIN_START.sh :
FILE_PATH="C:\DEV\REPO\GIT\AHK03\SHORTCUTS\SHORTCUTS_MAIN.ahk"
EXEC_PATH="C:\DEV\REPO\GIT\AHK03\AHK_ROOT\AutoHotkeyU64.exe"
$EXEC_PATH $FILE_PATH
This example opens the file denoted by $FILE_PATH with the executable denoted by $EXEC_PATH. If this doesn’t work for you, try converting the single slash ( «\» ) into double slashes ( «\\» ) for the paths.
answered Sep 19, 2017 at 16:16
KANJICODERKANJICODER
3573 silver badges6 bronze badges
In the Windows command prompt, you can run
edit [file_name]
in order to view batch files/logs/text files etc. This command requires QBASIC.EXE
, which is by default present in Windows.
See here for other useful MS-DOS commands.
Dave
25.3k10 gold badges58 silver badges70 bronze badges
answered Sep 10, 2012 at 6:54
3
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
The Windows Command Prompt can be used to search for and open any files on your PC. This is very useful if you saved your file to an unknown folder and only remember a part of the file name. However, there’s no benefit nor harm in applying this method to files with a known location. But for those files that are difficult to locate, this article shows how to find and open files in Command Prompt in Windows 11 and Windows 10.
Content
- What Is the Benefit of Using the Command Prompt to Open Files?
- How to Open Command Prompt in Windows
- How to Search for Files Using Command Prompt in Windows
- How to Change Directories in Windows Command Prompt for Easy Access to Folder Paths
- How to Open Files in Command Prompt by File Name and File Type
- How to Search for the Correct Files With Command Prompt
- How to Open Files in Windows Command Prompt
- How to Open Files Using Windows Terminal
- Frequently Asked Questions
Also read: How to Use Windows Defender from the Command Prompt
What Is the Benefit of Using the Command Prompt to Open Files?
Whether you are looking for all your files concerning one topic or just trying to find the one hiding among all the folders on your computer, try using the Command Prompt. It may make it more efficient for you.
On top of that, using the Command Prompt is much 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, as the GUI always consumes more memory and slows down the processes.
Also read: 8 Ways to Customize Windows Terminal
To search for the files in Windows, you first need to launch Command Prompt. There are several ways to do this:
- Through Search Box. Type
cmd
in the Windows search box, then click on the icon to open the window. It’s wise to always operate the command line as an administrator.
- Use the Run window. A fast way to launch
cmd
is to press the Win + R keys, Then typecmd
orcmd.exe
and press Enter or click «OK.» To directly launch Command Prompt in Admin mode, press Ctrl + Shift + Enter.
- Use Win + X : Another fast way to launch
cmd
is to use the Win + X combination, also known as the Power User menu. Among the various options in Windows 11, you will find Windows Terminal and Windows Terminal (Admin), which are the latest terminal emulators to run both Command Prompt and PowerShell from one window.
Note: in certain older Windows 10 versions, when you launch the Win + X hotkey combination, you may instead see the Command Prompt and Command Prompt (Admin) options.
- Use Cortana: try Cortana if it works for you. As soon as you see ther Cortana is «listening» to text, say «open command prompt,» and it will open up.
Also read: Windows Security Not Opening in Windows? Here are 6 Fixes
How to Search for Files Using Command Prompt in Windows
Searching for files and folders using the command line is very easy. Follow the instructions below:
- In Command Prompt, type
dir "search term*" /s
, but replace the words «search term» with the file name or a part of the name you remember. In the following screen, we are trying to search for a folder/file titled «Stock videos.»
- Once you press Enter, it may look like nothing is happening for a second or two, but soon all the file paths mentioning the correct file or folder will be identified and named. The correct file path can be easily identified by the size of the folder.
What do all the terms mean in the command line search request?
dir
is a command used to show files in the current directory but can also locate data elsewhere in the system.- The backslash (\) tells
dir
to search from the root directory of the current drive. /s
tellsdir
to search all sub-directories.*
is used by command-line apps as a wildcard. It indicates that the search will locate all file names that contain your search term.- Adding 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 use it at the beginning, your search will only include results with your text at the end. For example,
*.jpg
. - If you add 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.
Also read: 15 Safe Websites for Downloading Windows Software
How to Change Directories in Windows Command Prompt for Easy Access to Folder Paths
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 change the Windows drive path in the command line as shown below.
- Type
cd..
which enables you to easily move one folder up. - To go to D drive, just type
d:
, and the Command Prompt will listen to the new drive.
- Using
cd
without the two dots allows you to set a new folder path as the default directory for systematic file navigation. - Using
cls
clears the entire screen and returns you to the previous folder path.
Also read: How to Permanently Disable Windows Defender
How to Open Files in Command Prompt by File Name and File Type
We will explore a simple demonstration of how to open a file clearly visible to you as system administrator. To do this, you would need the location of the saved file. In this example, the file that we want to open is located in the Desktop folder.
- Navigate to the required folder from «This PC» and right-click to select «Properties.» This will give you that folder’s path that is unique to your computer.
- Using
cd
change your Command Prompt’s root directory to the desired folder.
- Once you’re set to the right folder, open the file by typing the entire
filename
and.filetype
. In the following example, the filename is «Marathon,» and the filetype is an .MP4 video.
- After typing the filename/filetype command, the correct file will be launched on your desktop window.
Also read: 6 Ways to Check Hard Disk Health in Windows
How to Search for the Correct Files With Command Prompt
Within the destination drive, you can search for the correct file once again using the dir "search term*" /s
command discussed earlier. 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. If you type correctly, you will identify the folder path and the correct file name.
If the folder path is very long, you can copy-paste the entire thing. Windows 11 has built-in support for copy-pasting in the command line.
For Windows 10, check out this detailed tutorial on how to cut-copy-paste in the Command Prompt. The method is simple enough: use Ctrl + A to select the entire Command Prompt screen, then, release the mouse or trackpad click. This will make any part of the command screen selectable for a copy-paste action.
Also read: Do I Need Antivirus Software If I Have Windows Defender?
How to Open Files in Windows Command Prompt
Once you find the file you want to open, you can open it from the Command Prompt screen using its default program without having to locate it in your file explorer.
- 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 earlier. Once the correct directory menu has been opened, you can open any files. - Enter the file name inside the quotation marks
".."
Press Enter and the file will open using its default application.
Note: you can open multiple files from the Command Prompt once you’ve opened the correct folder. Here we are opening a single video file in the command line window.
- You can use specific apps to open the file of your choice in Command Prompt. For example, video files can be opened using VLC Player. Identify the file location of the app you want to use to open the desired file.
- The file location of the app is accessible in «Properties.» Copying the path is useful, as it will be pasted directly to the Windows command line.
- Use
"App Location Path" "File Path"
to open the file with the app of your choice in Command Prompt.
Navigating your computer’s files using the Command Prompt is very similar to doing the same with file explorer.
Also read: How to Hide Updates Using PowerShell in Windows
How to Open Files Using Windows Terminal
The Windows Terminal is just a modern extension of the Command Prompt. Opening files in Windows Terminal is no different than the above methods.
- You need to change the default Terminal application to Command Prompt from a «+» menu if it’s set at something else, such as PowerShell or Azure Cloud Shell.
- The Command Prompt will become the default Terminal application for opening files.
- In the following Windows Terminal example, we are typing
cd..
to navigate to theC:\Windows
folder. - we are opening the Registry Editor file in that location by simply typing
regedit
.
Also read: 9 JavaScript/Node.js One-Liners You Should Know
Frequently Asked Questions
Can I open the Command Prompt window in a Windows folder?
You can open the Command Prompt window anywhere on a Windows PC. To do so in a Windows folder, navigate to the folder first, then right-click Windows terminal. The command prompt can be accessed as part of the Windows terminal.
How do I display the contents of a text file in Command Prompt?
To display the contents of a text file in command prompt, enter the type
command as shown below:
type [<drive>:][<path of file>]<Name of File>
Can I edit text files in Windows Command Prompt?
You can edit, view, create or modify any text document in Command Prompt.
- Use the
type
command followed by the file name. - Copy-paste the text in the command window using
copy con
followed by the text name and location. - Edit the document.
Can I batch rename files in Command Prompt?
Image credit: claudiodivizia by 123RF. All screenshots by Sayak Boral
Sayak Boral is a technology writer with over eleven 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.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
The command line is a powerful tool in Windows 10/11. Using the Command Prompt, PowerShell, or Windows Terminal, you can open any file you want with a single command.
One of the basic functions of the Command Prompt is creating a file, navigating folders, and opening files. Compared to using File Explorer, the command line makes it quick work to open a file by avoiding the need to navigate through various folders and menus. To open a file using Command Prompt or PowerShell, all you have to do is type the appropriate command and press Enter.
Opening files from the command line is especially useful when creating scripts, opening multiple files at once, working with large files, etc. For example, I use the trick below to open Chrome using Command Prompt.
In this article, I will explain all the necessary commands and usages to open files with Command Prompt on Windows 10/11.
Table of contents:
- How to open a file using Command Prompt
- How to find a file using Command Prompt
- Conclusion
How To Open a File Using Command Prompt
There are three ways you can open files from the Command Prompt window. You can navigate to the folder first and then open the files, open the file directly using the full file path, or open a file with a specific program. I will show all three methods. Each method is useful in a different situation. So, learn and use them as and when needed.
Important note: Though the guide talks about Command Prompt, you can follow the same steps in PowerShell or Windows Terminal.
Open files using Command Prompt by first navigating to the folder
If you know where the file is located, you can navigate to that folder in Command Prompt and then open it. That way, you don’t have to type the full file path whenever you want to open it. This is particularly useful if you are working on multiple files in the same directory.
- Open Command Prompt.
- Use “cd C:\path\to\folder” to navigate to the folder.
- Type “fileName.png” to open the file in Command Prompt.
- Close the Command Prompt window.
Steps with more details:
First, open the Command Prompt window. To do that, search for “Command Prompt” in the Start menu and click on the top result. If you want, you can open “Windows Terminal” and then open “Command Prompt” from the title bar.
After opening the Command Prompt window, type “cd C:\path\to\folder” while replacing the dummy path with the real path and press Enter. This will change the directory and take you to the folder you want.
Note: If you are trying to navigate to another drive in command line, like the D drive, you must execute the “DriveLetter:” (without quotes) command where “DriveLetter” is the actual drive letter. For example, you should run “D:” (without quotes) to navigate to the D drive. Once you are in the drive, use the CD command.
Once you are in the directory, type “fileName.png” to open the file. Of course, replace the dummy file with the actual file name and extension.
As soon as you do that, the file will be opened with the default program. For instance, if you are opening an image, it will be opened in the Photos app unless you set another app as the default photo viewer.
Open files using Command Prompt directly
You open files directly using the Command Prompt. i.e., without navigating to the folder first. This method is useful when you don’t want to change the directory, when opening multiple files in different directories, etc.
- Open Command Prompt.
- Type “C:\path\to\fileName.png” to open the file in Command Prompt.
- Close the Command Prompt window.
Steps with more details:
Open the Command Prompt window by searching for it in the Start menu. Alternatively, press the “Windows key + X” shortcut and select “Terminal.” Next, open Command Prompt from the terminal title bar dropdown menu.
In the Command Prompt window, type the line below with quotes while replacing the dummy file path with the real one. Of course, don’t forget the file extension.
"C:\path\to\fileName.png"
For example, I’d use the below command line to open an Excel file.
"D:\WindowsLoop\My Folder\Yearly Commissions.xlsx"
As soon as you do that, the file will be opened in the default program. In my case, it will be the MS Excel application.
Open files with a specific program using Command Prompt
Sometimes, you might want to open a file with a specific program. For example, rather than opening an image file with the default Photos app, you might want to use an alternate program like Photoshop, Quick Picture Viewer, etc. In those cases, you can use the below method.
- Open Command Prompt.
- Type “C:\path\to\program.exe” C:\path\to\fileName.png” to open the file in Command Prompt with a specific program.
- Close the Command Prompt window.
Steps with more details:
Open the Command Prompt window by searching for it in the Start menu. Alternatively, press the “Windows key + X” shortcut and select “Terminal.” Next, open Command Prompt from the terminal title bar dropdown menu.
Next, run the below command with quotes while replacing the program and file paths with real paths.
"C:\path\to\program.exe" C:\path\to\fileName.png"
For example, I want to open an image with Quick Picture Viewer. So, I use the below command.
"C:\Program Files (x86)\QuickPictureViewer\quick-picture-viewer.exe" "D:\WindowsLoop\My Image.png"
The file will be opened with the selected application as soon as you execute the command.
How To Find a File Using Command Prompt
Sometimes, you might want to find the file in Command Prompt before opening it. This is especially true if you want to confirm the file exists before opening it so that you don’t face errors.
Here’s how to find files in Command Prompt:
- Open Command Prompt.
- Use “cd C:\path\to\folder” to navigate to the folder.
- Run the “dir “\search term*” /s” command to search and find the files.
- To find a specific file, run the “dir “\fileName.png” /s” command.
- Close the Command Prompt window.
Steps with more details:
Open the Command Prompt window by searching for it in the Start menu. Alternatively, press the “Windows key + X” shortcut and select “Terminal.” Next, open Command Prompt from the terminal title bar dropdown menu.
Use the CD command to navigate to the folder of your choice.
cd "C:\path\to\folder"
In the Command Prompt window, run the below command while replacing “search term” with the actual file name and press the “Enter” button.
dir "\search term*" /s
If you want to search for a specific file, use the full file name along with the extension. The command looks something like this:
dir "\fileName.png" /s
As soon as you run the search command, the Command Prompt will scan the directories and sub-directories to find the file. Once found, it will list the full file path in the response.
Quickly Opening Files With Command Prompt — Conclusion
Opening files in Command Prompt is a powerful and effective way to handle your files and save time on regular tasks. I’ve gone over three methods to open files in Command Prompt and explore and find files using various commands. Depending on your use case, follow the method that is useful to you.
Learning how to use the command line to open files is a useful skill to have whether you are a casual user or a professional.
—
That is all. It is that simple to open a file using Command Prompt.
I hope this simple and easy Windows how-to guide helped you.
Contents
- 1 How to Open a File in Command Prompt
- 2 How to Open a Folder in CMD
- 3 Extra: How to Stop, Start, and Restart a Service with Command Prompt
- 4 Extra: How to Run Windows Defender from the Command Line
Many of the tasks you can perform via your UI, you can also do in Command Prompt. This extends to opening files and folders, which you may want to do if you’re using a GUI-less install, or your File Explorer is broken. Today we’re going to show you how to open a file or folder in Command Prompt in Windows 11 in just a few seconds.
To do so, we’ll be making use of the new Windows Terminal application, which allows you to quickly access CMD, PowerShell, and more.
How to change directory in command prompt
As part of the process, this tutorial will briefly cover how to navigate to files in CMD. It won’t, however, show you how to open Command Prompt in a specific folder, as we already have a tutorial on that here. With that said, lets’ get started:
To open a file using Command Prompt, you just need to navigate to its folder and then type the file name. Here’s an example:
- Right-click your Start button and press “Windows Terminal (Admin)”
- Click the dropdown arrow next to the plus icon and select “Command Prompt”
- Navigate to your desired folder with “cd”, then type your file name in quotes
For example, our file is in the “wonder” folder on our desktop. To get there, you would type:
cd C:\Users\User Name\Desktop\wonder
We know that the file is called “cafe” and is a jpeg filetype, so to open it we can just type
"cafe.jpg"
and press Enter.If you’re unsure what your file is called, you can type
ls
while in a folder. This will list every file inside of it in CMD. - Your file will open in its default program
- Try opening a different file type
This trick works not just with images, but documents and basically any file on your PC that you have the software to open. In the example below, we navigate to a folder on the desktop and then open an excel worksheet:
cd C:\Users\Maria Winbuzzer\Desktop\wonder
"2019.xlsx"
- Your Excel workbook will open in its default program: Excel
How to Open a Folder in CMD
Opening a folder in Command Prompt is even easier. You can do it in a single command. It’s not the easiest to remember, but every convenient once you have it down. Note that this is different from navigating to a folder in CMD because it will actually open the file in Windows Explorer:
- Type the following command and Press Enter
With Command Prompt selected in your terminal type the following command and substitute the folder path with one to the folder you want to open:
start %windir%\explorer.exe "C:\Users\Maria Winbuzzer\Desktop\wonder"
- Windows will open your folder in File Explorer
Extra: How to Stop, Start, and Restart a Service with Command Prompt
As we mentioned, there are hundreds of things you can do with Command Prompt rather than using the UI. One of them is managing your services. You can learn how by following our dedicated guide here.
Extra: How to Run Windows Defender from the Command Line
You can also run Windows Defender from Command Prompt, updating it, performing scans, and more. Follow our existing tutorial to find out how.