As Microsoft continues to develop its operating systems, we see the emergence of new tools and features designed to enhance user experience and productivity. A significant addition in this regard is the Windows Terminal. This article will guide you through the process of opening files and folders using Windows Terminal’s Command Prompt (CMD) or PowerShell on Windows 11.
Also see: How to Download an FTP File Using CMD in Windows 11/10
Page Contents
What is Windows Terminal?
Windows Terminal is a modern terminal application introduced by Microsoft. It facilitates the use of different command-line environments under one unified window. This includes the traditional Command Prompt (CMD), PowerShell, Azure Cloud Shell, and others.
By default, Windows Terminal launches with PowerShell, a task-based command-line shell built on .NET. It’s especially designed for system administration, offering more functionalities compared to CMD. However, if you prefer using CMD or have specific tasks that require it, you can modify your Windows Terminal settings to launch CMD by default.
Changing the default terminal to CMD in Windows Terminal
Should you wish to default to the Command Prompt in Windows Terminal, you can do so by following these steps:
- Launch Windows Terminal by simply right-clicking the Start menu and selecting “Windows Terminal (Admin)“.
- Click on the downward arrow located at the top of the application, next to the tabs.
- Select “Settings” from the dropdown menu.
- In the left pane, choose “Startup“.
- On the right, click the drop-down menu next to “Default profile” and select “Command Prompt” (or whichever terminal you want to switch to).
- Click “Save” to save the changes.
- Restart your Windows Terminal to see it open Command Prompt as the default terminal.
Related resource: Add Folder to Path Environment Variable in Windows 11/10
Opening a file in Windows Terminal
To open a file using Windows Terminal’s Command Prompt or PowerShell, you need to navigate to the directory that contains the file, and then call the appropriate command to open the file.
Read: How to Change Directory/Drive in CMD on Windows 11
In Command Prompt:
- Open Windows Terminal in CMD.
- Use the
cd
command followed by the directory path to navigate to the directory that contains the file. For example, if the file is inC:\Documents
, you would type:cd C:\Documents
. - Once you’re in the correct directory, use the
start
command followed by the filename to open the file. For example, if the file is namedexample.txt
, you would type:start example.txt
.
In PowerShell:
- Open Windows Terminal in PowerShell.
- Use the
cd
command followed by the directory path to navigate to the directory that contains the file, similar to CMD. - To open the file, use the
Invoke-Item
command, or its aliasii
, followed by the filename. For example, if the file is namedexample.txt
, you would type:Invoke-Item example.txt
orii example.txt
.
Useful tip: What is “Copy as Path” in Windows 11 and what does it do?
Opening a folder via Windows Terminal
To open a folder in File Explorer using the command line interface in Windows Terminal, you will use different commands based on whether you are operating in CMD or PowerShell.
In CMD:
- Open Windows Terminal in CMD.
- Use the
cd
command followed by the directory path to navigate to the desired folder. For example, if you want to open the folder atC:\Documents
, you would type:cd C:\Documents
. - Once you’re in the correct directory, use the
start
command followed by a period to open the folder in File Explorer. Simply type:start .
.
In PowerShell:
- Open Windows Terminal in PowerShell.
- Use the
cd
command followed by the directory path to navigate to the desired folder, similar to CMD. - To open the folder in File Explorer, use the
ii
command (an alias forInvoke-Item
) followed by a period. Simply type:ii .
.
These commands will launch File Explorer and directly open the folder you specified, allowing you to view and manage the files in a GUI-based environment. This method is particularly useful when you wish to switch to a graphical interface for file management tasks or when you need to visually cross-reference the contents of a directory while working in the terminal.
Recommended guide: How to Take Ownership of a File, Folder or Drive in Windows 11
Additional tips
You can also drag and drop a file or folder into the Windows Terminal window to automatically fill in its path. This can be a time-saver, especially when working with files or folders located in deeply nested directories.
Another handy feature of Windows Terminal is its built-in search functionality. By pressing Ctrl+Shift+F, you can easily search for text within your current terminal session. This is especially useful when you’re sifting through large amounts of output.
Furthermore, if you find yourself often working with a specific directory, you can set it as your default directory in Windows Terminal. To do this, you’ll need to modify the startingDirectory
setting in your profile in the settings file.
Finally, remember that both CMD and PowerShell have extensive help systems. If you’re ever unsure about a command, you can type help
followed by the command name to get more information about how to use it.
Wrapping up
While GUIs are user-friendly and visually appealing, they sometimes fall short in terms of efficiency and automation potential. CLI, on the other hand, shines in these areas. It allows for the creation of scripts that can automate repetitive tasks, perform complex file management operations, and even interact with network resources, making it an indispensable tool for system administrators and power users.
Whether you’re a seasoned system administrator or a developer, learning how to navigate and open your files and folders from the command line is an invaluable skill. And with the flexibility to switch between PowerShell and CMD in Windows Terminal, you can always choose the right tool for the job.