-
Home
-
News
- How to Open a File/Folder in Command Prompt (CMD) Windows 10
By Alisa |
Last Updated
Wonder how to open a file cmd or how to open a folder in Command Prompt on Windows 10? This tutorial provides a step-by-step guide. Also, if you can’t find some files or folders in Windows 10, or some files are unexpectedly lost in your Windows 10 computer, MiniTool free data recovery software for Windows 10/8/7 can help you easily recover lost files.
You can also open files from Command Prompt. Wonder how to open a file or folder in Command Prompt on Windows 10? Check the step-by-step guide in this tutorial.
How to Open a File CMD Windows 10 in 2 Steps
Step 1 – Open Command Prompt
You have several ways to open Command Prompt in Windows 10.
You can press Windows + R keys on the keyboard to open Windows Run dialog. Then type cmd in the Run box. If you want to run Command Prompt as Administrator, you need to press Ctrl + Shift + Enter keys at the same time.
Alternatively, you can also click Start or Search box in Windows 10, and type cmd or command prompt. Right-click the Command Prompt app in the list and choose Run as administrator.
Step 2 – Open Files from Command Prompt
Normally you have two ways to open a file using cmd. One is to move the folder that the file is in, the other is to open the files directly in Command Prompt.
Method 1. How to open a file with cmd by moving to the folder firstly
- You can use the cd command to move to the exact folder the file lies in. For instance, cd C:\Users\mini\Desktop.
- After you are in the correct folder path, you can type the name of the file with its extension, e.g. “travel.png”, and hit Enter button to open it.
Method 2. How to open a file using cmd directly
You can also choose to open files from Command Prompt on Windows 10 directly, instead of going to the folder path. You can input the full path, file name and its file extension to open the target file, e.g. “C:\Users\mini\Desktop\travel.png”.
You can also freely specify an app to open the file. You need to type the whole path of the app ahead of the path of the file, for example, “%windir%\system32\mspaint.exe” “C:\Users\mini\Desktop\travel.png”. Press Enter to open the file using CMD.
How to Open a Folder in Command Prompt Windows 10
You can also open a folder from Command Prompt with the command line below.
After you enter into Command Prompt window by following the operation above, you can open a folder in File Explorer in Command Prompt. The command line can be like this, start %windir%\explorer.exe “C:\Users\mini\Desktop”.
Tip: Need to mention that you need to enclose the path of a file or folder in double quotation marks, since some folder or files names have spaces in them.
>> Quick Video Guide:
To Recover Unexpectedly Lost Files or Folders in Windows 10
Sometimes you may suffer unexpected data loss in Windows 10 due to various reasons, e.g. system crash, Blue Screen error (e.g. Bad Pool Caller BSOD error), power outage, malware/virus infection, hard drive failure, etc. To easily recover lost data for free, you can choose the best free data recovery software to realize it.
MiniTool Power Data Recovery, a 100% clean and free data recovery software for Windows 10/8/7, enables you to easily recover mistakenly deleted files or lost files from computer local drive, external hard drive, SSD drive, USB drive (pen drive data recovery), SD card, and more.
MiniTool Power Data Recovery TrialClick to Download100%Clean & Safe
About The Author
Position: Columnist
Alisa is a professional English editor with 4-year experience. She loves writing and focuses on sharing detailed solutions and thoughts for computer problems, data recovery & backup, digital gadgets, tech news, etc. Through her articles, users can always easily get related problems solved and find what they want. In spare time, she likes basketball, badminton, tennis, cycling, running, and singing. She is very funny and energetic in life, and always brings friends lots of laughs.
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.
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:\Users\fatiw\Desktop
Once you’re in the correct folder, enter the name of the file you want to open with its extension and tap enter.
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:\Users\fatiw\Desktop\audio 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 Files\Adobe\Adobe Photoshop CC 2018\Photoshop.exe" "C:\Users\fatiw\Desktop\audio 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:\Users\fatiw\Desktop"
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.
Fatima Wahab
Fatima has been writing for AddictiveTips for six years. She began as a junior writer and has been working as the Editor in Chief since 2014.
Fatima gets an adrenaline rush from figuring out how technology works, and how to manipulate it. A well-designed app, something that solves a common everyday problem and looks
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 11/10 PC.
What you will learn:
- How to navigate to a folder using Command Prompt and PowerShell.
- How to open a folder using Command Prompt and PowerShell.
- How to close a file using Command Prompt and PowerShell.
In the post remember to replace <username>
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:
cd Path\To\Folder
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:
cd C:\Users\<username>\Desktop\New Folder
To open a file saved in this folder, input the name of the file and press ENTER. Example,
Path\To\Folder new-file.txt
Alternatively, you can enter the full path to the file without using the cd command. For example,
C:\Users\<username>\Desktop\New Folder\new_file.txt
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:
start C:\Users\<username>\Desktop\New Folder
If you want to open the current folder, run the start command with a fullstop (.):
start .
To open the parent folder to your current folder, use two fullstops (..):
start ..
On hitting ENTER, the specified folder will open in a File Explorer window.
Read: How to open Folder with Keyboard Shortcut in Windows
PowerShell
To open a folder in File Explorer using PowerShell, input either of the following cmdlets –
Invoke-Item
or
ii
and add the path to the folder.
ii C:\Users\<username>\Desktop\New Folder
To open the current directory, use the following command:
ii
TIP: This post will show you how to create, delete, find, rename, compress, hide, move, copy and manage a file or folder using Command Prompt
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:
C:\Path\To\Folder
Enter the following command when you are in the correct directory:
taskkill /im filename.exe /t
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.
Now read: Ways to open a Command Prompt in a Folder.
I hope you find the post useful.
Download Article
Download Article
Do you need to access a certain folder at the Windows command prompt? The command prompt might seem archaic, but it’s actually really easy once you learn some basic commands. This wikiHow article will show you how to use the «cd» command to open a folder at the Windows command prompt. We’ll also show you a cool trick that will help you instantly open a command prompt from any folder using Windows File Explorer.
-
File Explorer is the default file browser for Windows. To open File Explorer, press the Windows key and «E» at the same time.[1]
-
Use File Explorer to browse to the folder you want to open. Then click the folder to open it.
Advertisement
-
This opens a new Command Prompt window inside the folder you currently have open in File Explorer.[2]
Advertisement
-
File Explorer is the default file browser for Windows. To open File Explorer, press the Windows key and «E» at the same time.
-
Using the panel on the left side of File Explorer, click the folder you want to open. Then click the folder to open it.
-
This displays a context menu next to your mouse cursor.[3]
-
This opens the Command Prompt inside the folder.[4]
- On newer versions of Windows, this option has changed to Open PowerShell window here. PowerShell is a more advanced version of Command Prompt. Most commands that work in Command Prompt will also work in PowerShell.
Advertisement
-
It’s the icon that has the Windows logo. It is in the lower-left corner by default. This opens the Windows Start menu.
-
This displays the Command Prompt in the Windows Start menu.
-
It has an icon that resembles a black screen with a white text cursor. Click the Command Prompt icon in the Windows Start menu to open Command Prompt.[5]
-
If the folder you want to open is on a different drive other than the drive your Windows operating system is installed on, you need to switch to that drive in Command Prompt. To do so, type the letter of the drive followed by a colon (e.g. «D:») and then press Enter.
- You only need to do this if the folder is not located on the drive that Windows is installed on (which is usually the «C:» drive.)
-
The «cd» command is used to change directories in the Windows command prompt. Type «cd» followed by a space, but do not press Enter just yet.
-
You’ll need to include every folder and sub-folder the folder is located in. Place a backslash («\») in front of each folder name. For example; «cd \Users\username\Documents.»[6]
- If you are not sure what the path of the folder is, you can navigate to the folder in File Explorer. Right-click the address bar at the top and click Copy address as text. You can then press Ctrl + V to paste the path of the folder directly into Command Prompt right after the «cd» command.
Advertisement
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Video
Thanks for submitting a tip for review!
Thanks for reading our article! If you’d like to learn more about Computer Networking, check out our in-depth interview with Stan Kats.
References
About This Article
Article SummaryX
1. Click the Windows Start menu and type «cmd».
2. Click the Command Prompt icon to open it.
3. Type «cd» followed by a space.
4. Type the address of the folder after the space (i.e. «/Users/username/Documents.»)
5. Press Enter.
Did this summary help you?
Thanks to all authors for creating a page that has been read 553,066 times.
Is this article up to date?
Программистам часто приходится работать в консоли — например, чтобы запустить тестирование проекта, закоммитить новый код на Github или отредактировать документ в vim. Всё это происходит так часто, что все основные действия с файлами становится быстрее и привычнее выполнять в консоли. Рассказываем и показываем основные команды, которые помогут ускорить работу в терминале под OS Windows.
Для начала нужно установить терминал или запустить командную строку, встроенную в Windows — для этого нажмите Win+R
и введите cmd
. Терминал часто встречается и прямо в редакторах кода, например, в Visual Studio Code.
Чтобы ввести команду в консоль, нужно напечатать её и нажать клавишу Enter
.
Содержимое текущей папки — dir
Выводит список файлов и папок в текущей папке.
C:\content-server>dir
Том в устройстве C имеет метку SYSTEM
Серийный номер тома: 2C89-ED9D
Содержимое папки C:\content-server
06.10.2020 00:41 <DIR> .
06.10.2020 00:37 <DIR> .circleci
16.07.2020 16:04 268 .editorconfig
16.07.2020 16:04 10 .eslintignore
16.07.2020 16:04 482 .eslintrc
06.10.2020 00:37 <DIR> .github
16.07.2020 16:04 77 .gitignore
06.10.2020 00:41 <DIR> assets
06.10.2020 00:41 <DIR> gulp
16.07.2020 16:10 379 gulpfile.js
16.07.2020 16:10 296 320 package-lock.json
16.07.2020 16:10 751 package.json
16.07.2020 16:04 509 README.md
Открыть файл
Чтобы открыть файл в текущей папке, введите его полное имя с расширением. Например, blog.txt или setup.exe.
Перейти в другую папку — cd
Команда cd
без аргументов выводит название текущей папки.
Перейти в папку внутри текущего каталога:
C:\content-server>cd assets
C:\content-server\assets>
Перейти на одну папку вверх:
C:\content-server\assets>cd ..
C:\content-server>
Перейти в папку на другом диске:
c:\content-server>cd /d d:/
d:\>
Чтобы просто изменить диск, введите c:
или d:
.
Создать папку — mkdir или md
Создаём пустую папку code
внутри папки html
:
d:\html>mkdir coded:\html>dir
Содержимое папки d:\html
03.11.2020 19:23 <DIR> .
03.11.2020 19:23 <DIR> ..
03.11.2020 19:25 <DIR> code
0 файлов 0 байт
3 папок 253 389 438 976 байт свободно
Создаём несколько пустых вложенных папок — для этого записываем их через косую черту:
d:\html>mkdir css\js
d:\html>dir
Том в устройстве D имеет метку DATA
Серийный номер тома: 0000-0000
Содержимое папки d:\html
03.11.2020 19:23 <DIR> .
03.11.2020 19:23 <DIR> ..
03.11.2020 19:25 <DIR> code
03.11.2020 19:29 <DIR> css
Создаётся папка css
, внутри которой находится папка js
. Чтобы проверить это, используем команду tree
. Она показывает дерево папок.
Удалить папку — rmdir или rd
Чтобы удалить конкретную папку в текущей, введите команду rmdir
:
d:\html\css>rmdir js
При этом удалить можно только пустую папку. Если попытаться удалить папку, в которой что-то есть, увидим ошибку:
d:\html\css>d:\html>rmdir css
Папка не пуста.
Чтобы удалить дерево папок, используйте ключ /s
. Тогда командная строка запросит подтверждение перед тем, как удалить всё.
d:\html>rmdir css /s
css, вы уверены [Y(да)/N(нет)]? y
Показать дерево папок — tree
В любом момент мы можем увидеть структуру папок. Для этого используется команда tree
.
d:\html>tree
Структура папок тома DATA
Серийный номер тома: 0000-0000
D:.
├───code
└───css
└───js
Если вы хотите посмотреть содержимое всего диска, введите tree
в корне нужного диска. Получится красивая анимация, а если файлов много, то ещё и немного медитативная.
Удаление файла — del или erase
Команда для удаления одного или нескольких файлов.
d:\html>del blog.txt
Переименование файла — ren или rename
Последовательно вводим ren
, старое и новое имя файла.
d:\html>dir
Содержимое папки d:\html
03.11.2020 19:23 <DIR> .
03.11.2020 19:23 <DIR> ..
03.11.2020 19:59 0 blag.txt
d:\html>ren blag.txt blog.txt
d:\html>dir
Содержимое папки d:\html
03.11.2020 19:23 <DIR> .
03.11.2020 19:23 <DIR> ..
03.11.2020 19:59 0 blog.txt
Команды одной строкой
Очистить консоль — cls
.
Информация о системе — systeminfo
.
d:\html>systeminfo
Имя узла: DESKTOP-6MHURG5
Название ОС: Майкрософт Windows 10 Pro
Версия ОС: 10.0.20246 Н/Д построение 20246
Изготовитель ОС: Microsoft Corporation
Параметры ОС: Изолированная рабочая станция
Сборка ОС: Multiprocessor Free
Информация о сетевых настройках — ipconfig
.
d:\html>ipconfig
Настройка протокола IP для Windows
Адаптер Ethernet Ethernet 2:
Состояние среды. . . . . . . . : Среда передачи недоступна.
DNS-суффикс подключения . . . . . :
Список запущенных процессов — tasklist
.
c:\>tasklist
Имя образа PID Имя сессии № сеанса Память
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 8 КБ
System 4 Services 0 2 688 КБ
Secure System 72 Services 0 23 332 КБ
…
Справка по командам — help
Команда help
без аргументов выводит список всех возможных команд. help
вместе с именем команды выведет справку по этой команде.
d:\html>help tree
Графическое представление структуры папок или пути.
TREE [диск:][путь] [/F] [/A]
/F Вывод имён файлов в каждой папке.
/A Использовать символы ASCII вместо символов национальных алфавитов.
В этой статье приведены не все команды и не все их возможности, но вы всегда можете воспользоваться командой help
и узнать о том, что ещё может командная строка.
👉🏻 Больше статей о фронтенде и работе в айти в телеграм-канале.
Подписаться
Материалы по теме
- 10 горячих клавиш VS Code, которые ускорят вашу работу
- Полезные команды для работы с Git
- Полезные команды для работы с Node. js
«Доктайп» — журнал о фронтенде. Читайте, слушайте и учитесь с нами.
ТелеграмПодкастБесплатные учебники