How to Change Default Folder in Windows Terminal
In this article, we will learn how to change the default working directory for PowerShell, Command Prompt and Ubuntu shell.
Change PowerShell's Default Directory in Windows Terminal
PowerShell is the default shell that opens when you launch Windows Terminal. Like other shells, PowerShell uses your current user directory as the default directory.
You can change this default directory just by adding a line of code in the Windows Terminal's settings file.
To get started, open the 'Start' menu, search for 'Windows Terminal' and click on the corresponding application in the results.
Next, click the down arrow icon at the top of the Windows Terminal window, then select 'Settings'.
Windows will ask you which application you want to open the installation file to. You can choose any code (or plain text) editor from the list, but we recommend using Notepad for simplicity. Please click 'Notepad' in the list and press 'OK'.
Once the settings file opens in Notepad, scroll to the 'Make changes here to the powershell.exe profile' section.
Place your cursor at the end of the last value in this section and enter a ',' (comma).
For example, if the final value in that section is:
"Hidden": false
Now it should look like this (notice the comma at the end.):
"Hidden": false,
Next, you press Enter to add a new line. Enter the following code in this line, replacing PATH with the path to your new default directory.
Make sure that your directory path has quotes. Also, when you have a slash in the path, set it to double slash.
"startingDirectory": "PATH"
For example, to set the desktop as the default folder, you must enter the following line of code in the settings file (replace "Username" with your username):
"startingDirectory": "C:UsersUsernameDesktop"
After entering the path, click File > Save in Notepad to save the changes.
From now on, when you open a new PowerShell tab in Windows Terminal, it will use the folder you just specified as the new default folder.
Change Command Prompt's Default Directory in Windows Terminal
You can also change the Command Prompt's default directory using the same steps as listed above. The only difference is that you need to add the new folder path in the Command Prompt section of the installation file.
First, open the Windows Terminal settings as above.
Scroll down to the 'Make changes here to cmd.exe profile' section.
Place your cursor after the last value in this section and enter a ',' (comma).
Press Enter to add a new line and enter the following code. Please replace the PATH value with the path to your new directory.
"startingDirectory": "PATH"
Click File > Save in Notepad to save your changes.
Change Ubuntu's Default Directory in Windows Terminal
You can use the same line of code above to change Ubuntu's (Linux) default directory in Windows Terminal.
First, open Windows Terminal's settings file as you normally would.
Scroll to the section that says "Name : Ubuntu."
Place your cursor after the last value in this section and add a ',' (comma).
Press Enter to add a new line and enter the following code, of course you will still have to replace the PATH value with the path to your new directory.
"startingDirectory": "PATH"
In Notepad, click File > Save to save the changes.
How to reset the default folder in Windows Terminal
To revert back to the original default directory in Windows Terminal, simply remove your newly added code from the settings file.
Start by opening Windows Terminal and then launch the installation file.
Navigate to the shell where you want to reset the default directory.
Use your mouse to highlight the entire line of code you added earlier, then press Backspace to delete it.
Also, remember to remove the ',' (comma) that you added at the end of the last value in that section.
Finally, click File > Save in Notepad to save the changes.
You should read it
- How to make Windows Terminal the default Terminal application and its benefits
- Windows Terminal will soon become the default terminal emulator in Windows 11
- How to delete the user and the machine name in the command prompt on Terminal
- Notable changes in Windows Terminal ver 0.11
- Windows Terminal is about to have a retro version with a 'classic' interface.
- How to set Windows Terminal to always open with Command Prompt on Windows 11
- How to enable transparent background on Windows Terminal
- How to reset Windows Terminal to default settings on Windows 10
May be interested
- Change the folder to save the default data in Windows 10normally when saving files on a computer, the file will automatically be saved to the default drive, such as c drive, such as document, picture, music or download, ....
- How to delete the user and the machine name in the command prompt on Terminalfor linux users (or macs) using terminal, you will see that the default prompt will have the format [username @ hostname ~] $. please note that this is only the default setting and you can freely change it.
- How to change the default Download path on Windows?i want to change the default download path on my system to another path, from the old path c: usersmynamedownloads to c: downloads. can i stop windows 10 from using my username profile location by default? and if so, how to change the default download path on windows 10?
- How to change the Dropbox folder default location?by default, the dropbox folder is stored on the user folder at c: users (or the home folder on os x and linux). however for some reason you want to change the default dropbox folder location.
- How to set a default folder opening in Finder on Macfinder represents your access to all files on a mac. by default, finder will open the recents folder. but, if you usually work in a different folder, you can change the default open folder when you open finder.
- Tips to change the default name of the newly created folder on Windows 10when you create a new folder in windows 10, the folder name will automatically be 'new folder'.
- How to customize Terminal on Macif you use terminal on a mac, you should change the look and some other features of this window for better productivity.
- How to change the default Download folder on any browser Chrome, Coc Coc, Edge, Firefoxthe web browser when you download the data put by default with windows that makes it difficult for you to determine the path. the following article will guide you in detail how to change the default download folder on any chrome browser, coc coc,
- Change the account and default storage folder of OneDrive on Windows 10by default, onedrive integrated in windows 10 will synchronize data and store in c drive partition. however, if you have a lot of data with multiple onedrive accounts, the system partition will be very fast. but the following way will help you choose another storage folder as well as change the default data synchronization location of onedrive.
- Customize folder colors in Windows with Folder Colorizeryellow is always the default color for windows folders. however, you can change them for unique, fancy folder folder colorizer.