How to open files and folders from the Command Prompt on Windows 10 [Guide]

The Command Prompt can do a lot things the Windows 10 UI doesn’t give you simple, quick access to. It can also do some basic stuff like open files and folders. The commands you need for it are pretty simple. Here’s how you can open files and folders from the Command Prompt.

Open files from Command Prompt

The only real trick to opening a file from the Command Prompt is moving to the correct folder that the file is in. You can do that, or you can give the full path to the file you want to open.

Move to folder

If you’re going to move to the folder that the file is in, you need to use the cd command.

Syntax

cd path-to-folder

Example

cd C:UsersfatiwDesktop

Once you’re in the correct folder, enter the name of the file you want to open with its extension and tap enter.

‘); if (navigator.appVersion.indexOf(“Mac”)!=-1) document.write(”);

Open file directly

To open the file directly, instead of moving to the folder, you need to specify the path with the name of the file you want to open, with the file extension.

Syntax

path-to-folder FileName.FileExtension

Example

"C:UsersfatiwDesktopaudio cut.jpg"

By default, Command Prompt will open the file in the default app that is set for it however, if you want, you can specify a different app to open the file.

Syntax

Path-to-app app-EXE-name path-to-file FileName.FileExtension

Example

"C:Program FilesAdobeAdobe Photoshop CC 2018Photoshop.exe" "C:UsersfatiwDesktopaudio cut.jpg"

Open folder from Command Prompt

To open a folder in File Explorer from Command Prompt, you need to run the following command.

Syntax

start %windir%explorer.exe path-to-folder

Example

start %windir%explorer.exe "C:UsersfatiwDesktop"

Since we’re just opening files and folders, you don’t need to open Command Prompt with admin rights. The commands will work regardless what privileges Command Prompt is running with.

One thing you ought to know about providing the path to a file or folder is that you need to enclose it in double-quotes. This is normal since most folder and file names have a space in them. If you neglect to use the double-quotes, the command won’t run. If your file name and folder path don’t have any spaces in them, feel free to run the commands without the double-quotes.

Close File

You can also use Command Prompt to close a file. The command is;

Syntax

taskkill /im filename.exe /t

Example

taskkill /im i_view64.exe /t

Of course, if an app is able to run multiple instances, like IrfanView or Microsoft Word, the command will close all the files that are open. You might lose unsaved progress so be careful with this one.

About Alex Miller 6306 Articles
Alex Miller is a bestselling Tech author currently working here. His work has received a lot of appreciation from users and is being made to work hard to meet the user's expectations.

Be the first to comment

Leave a Reply

Your email address will not be published.


*