Windows Terminal uses your current user directory as the default directory when you open it. However, you can change this to any directory on your Windows PC. We’ll show you 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, this one uses your current user directory as the default.
You can change this default directory by adding a single line of code in the Windows Terminal’s settings file.
To do this, open the “Start” menu, search for “Windows Terminal,” and click the app in the results.
Click the down-arrow icon at the top of the Windows Terminal window, and then select “Settings.”
Windows will ask what app you want to open the settings file with. You can choose any code (or plain-text) editor in the list, but we’ll stick with Notepad for the sake of simplicity. Click “Notepad” in the list and hit “OK.”
When the settings file opens in Notepad, scroll to the “Make changes here to the powershell.exe profile” section.
Put your cursor at the end of the last value in this section and type a , (comma).
For example, if the last value in that section was:
It would now look like this (See the comma at the end.):
Now, press Enter to add a new line. Type the following code in this line, replacing PATH with the path to your new default directory.
Make sure that your directory path is enclosed with double quotes. Also, where you have a single slash in the path, make it a double slash.
For instance, to set your desktop as the default directory, you’d type the following line of code in the settings file (replacing “Username” with your username):
After entering the path, click File > Save in Notepad to save your changes.
Now, when you open a new PowerShell tab in Windows Terminal, it’ll use your newly specified directory as the default directory.
Change Command Prompt’s Default Directory in Windows Terminal
You can change Command Prompt’s default directory using the same steps as those listed above. The only difference is that you need to add the new directory path in the Command Prompt section of the settings file.
To do this, open Windows Terminal’s settings like you did previously.
Scroll down to the “Make changes here to cmd.exe profile” section.
Put your cursor after the last value in this section, and type a , (comma). Press Enter to add a new line and type the following. Be sure to replace PATH with your new directory path.
Select File > Save in Notepad to save your changes.
Change Ubuntu’s Default Directory in Windows Terminal
You can use the same line of code that you used above to change Ubuntu’s (Linux) default directory in Windows Terminal.
To do this, open the Windows Terminal’s settings file.
Scroll to the section where it says “Name : Ubuntu.”
Put your cursor after the last value in this section and add a , (comma).
Press Enter to add a new line and type this code in that line. Replace PATH with the path to your new default directory.
In your Notepad window, click File > Save to save your changes.
How to Reset the Default Directory in Windows Terminal
To revert to the original default directory in Windows Terminal, you just need to remove your newly added code from the settings file.
Start by opening Windows Terminal and then launching the settings file.
Scroll to the shell that you want to reset the default directory for.
Use your mouse to highlight the entire line of code that you added previously, then press Backspace to delete that line.
Also, be sure to remove the , (comma) that you added to the end of the last value in that section.
Finally, click File > Save in Notepad to save your changes.
You’re all set.
Did you know that Windows Terminal offers many customization options? You can use these options to change how this tool looks and works on your computer.
- › How to Know If Your AirPods Are Charging
- › Steam Is Changing the Schedule for Its Yearly Sales
- › Say Goodbye to SwiftKey Keyboard on iPhone and iPad
- › “UnstableFusion” Makes AI Art Easy on Windows, Mac, and Linux
- › How to Hold Anonymous Polls and Q&A Sessions in Google Meet
- › Photoshop Elements and Premiere Elements Have New AI Tools