Profile should support running a set of commands on creation #14050

Closed
opened 2026-01-31 03:59:24 +00:00 by claunia · 2 comments
Owner

Originally created by @gilmishal on GitHub (May 30, 2021).

Description of the new feature/enhancement

I would like the ability to run a set of commands when opening a new profile from the dropdown.
An example of it would be running a cli tool in a specific context (WSL), or setting some environment variable (WSL - export).

Proposed technical implementation details (optional)

  1. Add a section to Profile Settings called startup scripts/commands
  2. Allow writing a bash/ps/batch scripts in a box

When creating a new terminal tab for this profile this script will run.

Originally created by @gilmishal on GitHub (May 30, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement I would like the ability to run a set of commands when opening a new profile from the dropdown. An example of it would be running a cli tool in a specific context (WSL), or setting some environment variable (WSL - export). <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) 1. Add a section to Profile Settings called startup scripts/commands 2. Allow writing a bash/ps/batch scripts in a box When creating a new terminal tab for this profile this script will run. <!-- A clear and concise description of what you want to happen. -->
Author
Owner

@LuanVSO commented on GitHub (May 30, 2021):

you can do this on.bash_profile, .profile, .bash_login, .login and on the command line property on terminal: like wsl -- bash --init-file ~/mycoolconfig.sh or powershell -noe -f script.ps1

@LuanVSO commented on GitHub (May 30, 2021): you can do this on`.bash_profile`, `.profile`, `.bash_login`, `.login` and on the command line property on terminal: like `wsl -- bash --init-file ~/mycoolconfig.sh` or `powershell -noe -f script.ps1`
Author
Owner

@zadjii-msft commented on GitHub (May 31, 2021):

Yep, you can absolutely run a bunch of commands in the "commandline" property.

e.g. for cmd: "commandline": "cmd.exe /k foo.bat"

@zadjii-msft commented on GitHub (May 31, 2021): Yep, you can absolutely run a bunch of commands in the [`"commandline"`](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-general#command-line) property. e.g. for cmd: `"commandline": "cmd.exe /k foo.bat"`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14050