Script Runner
An extension that allows you to run scripts via right-click.
Installation
- Open VS Code.
- Go to the Extensions view by clicking on the square icon on the sidebar or pressing
Ctrl+Shift+X on Windows or Cmd+Shift+X on MacOS.
- Search for "Script Runner".
- Install and reload VS Code.
- This extension is activated by default. Disable the extension to deactivate it.
Instructions
- Right-click on a file in the Explorer.
- Select
🔸 Run from the context menu.
- The script will run in the terminal.
Configuration
script-runner.commands (object) — maps file extensions to shell commands. Defaults cover .py, .js, .ts, .sh, .ps1, .dart, .go, and many others. Placeholders inside the command:
${file} — full path to the file
${dir} — directory containing the file
${fileName} — basename including extension
${fileNoExt} — basename without extension
${workspaceRoot} — workspace root (falls back to ${dir} outside a workspace)
Example: ".py": "python3 \"${file}\""
License
This extension is licensed under the MIT License.
| |