Set the default starting directory in Windows Terminal

We're diving into another post about the Windows Terminal and a common question I receive - how did you configure the starting directory to always be your desired folder? Let's check it out.

Tobias Zimmergren
Tobias Zimmergren

Presently sponsored by ScriptRunner
Get your free PowerShell Security e-Book!


This is another post in the series about fun and helpful Windows Terminal tips and tricks. Here's a list of the posts in this series.

Configure the default directory

Most of my operations with the Windows Terminal happen from my code or scripts. Most of these are located at my C:\code\ folder on my device. Granted, this could be any folder, in any location - even a %userprofile% type of folder. However, for me, the C:\code\ is my home, and this is something I can reference using %systemdrive%/code.

  • You can also use an absolute path. For example, on Windows you can use C:\\code\\ types of path.

Here's a small tip, but one of the most helpful things I've done to my daily tasks to avoid navigating back to the root time, and time again.

Open the settings editor from the drop-down menu in Windows Terminal, or hit Ctrl+, on Windows.

Modify the startingDirectory setting from your settings file. Save. Voila.

Modify the starting directory for your Windows Terminal settings file.

Different starting directory for different terminals

Sure enough, you can also configure different starting directories for different terminals. Here's one way to do that.

        //<cropped>
        
        
        "defaults":
        {
            // Put settings here that you want to apply to all profiles.
            "useAcrylic": true,
            "acrylicOpacity": 0.35,
            "colorScheme": "Solarized Dark Patched",
            "startingDirectory": "%SystemDrive%/code/"
        },
        "list":
        [
            {
                "name": "VS DEV",
                "commandline": "cmd.exe /k \"%SystemDrive%/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/Tools/VsDevCmd.bat\"",
                "startingDirectory": "%SystemDrive%/code/xplat/projects"
            },
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false,
                "startingDirectory": "%userprofile%/Documents"
            }
            
        //<cropped>

For every profile, I can change the startingDirectory, which in turn helps me stay more productive. Mostly because I use my various terminals for specific things - and most of my main work happens in the C:\code folder and subfolders, which is why I'm defining that as my default.

You can modify this to your likings.

Read more about how to get the fancy transparency effect in Windows Terminal.

Windows Terminal

Tobias Zimmergren

Hi, I'm Tobias. I plan, architect and develop software and distributed cloud services. Nice to meet you!