Windows Terminal lets you change the starting directory for any available command-line tool, and in this guide, you will learn how to complete this task.
On Windows 10, the Windows Terminal app is the new modern command-line experience to run Command Prompt, PowerShell, and Linux commands.
By default, you will always start in your profile location (%USERPROFILE%) when using the app. However, if you always change the directory to start running commands, Windows Terminal allows you to set a different working directory using the Settings UI or settings.json file.
In this guide, you will learn the steps to change the starting directory for any command-line tool available in the Windows 10 terminal experience.
- Change starting directory using Windows Terminal settings UI
- Change starting directory using Windows Terminal settings.json
Change starting directory using Windows Terminal settings UI
To change the starting directory for Command Prompt, PowerShell, or WSL2 distros, use these steps:
-
Open Windows Terminal.
-
Use the Shift + Ctrl + , (comma) keyboard shortcut to open the settings UI.
Quick note: This option is available starting version 1.6. You can use these steps to enable the settings interface on your computer. -
Click on Windows PowerShell, Command Prompt, or WSL distro, depending on the console you want to configure.
-
Click the General tab.
-
Under the “Starting directory” section, click the Browse button.
-
Select the location – for example, C:\.
-
Click the Select Folder button.
-
Click the Save button in the bottom-right corner.
Once you complete the steps, the next time you open the command-line tool, it will open in the specified directory.
Change starting directory using Windows Terminal settings.json
To change the starting directory using the settings.json file, use these steps:
-
Open Windows Terminal.
-
Use the Ctrl + Alt + , (comma) keyboard shortcut to open the settings.json file with the default code editor.
Quick tip: It is recommended to use Visual Studio Code. You can also open the file by clicking the menu (down-arrow) button next to the tab and selecting the Settings option. -
Under the “profiles” section, inside the brackets of the profile (cmd.exe, powershell.exe, or Windows.Terminal.Wsl) you want to update, type the following command to change the starting directory:
"startingDirectory": "C:\\"
In the command, make sure to change the “C:\\” for the path you want to start the command-line tool. Also, notice the extra “\” that is required to specify the setting.
Quick tip: If you have more than one line of code inside the bracket, make sure all the lines end with a comma (,) except for the last line. Otherwise, the settings may not save correctly. -
Use the Ctrl + S keyboard shortcut to save the file.
After you complete the steps, the settings will save, and the next time, the command-line tool will launch in the new path.