Script Runner Terminal is a VS Code extension that lets you run script files quickly from the active editor.
It supports three run modes:
Replace run: closes the previous terminal created by this extension for the current file, then runs again
Run in new terminal: keeps existing terminals and opens a new integrated terminal
Run in external window: opens a new system command window to run the current file
Supported File Types
.bat
.cmd
.ps1
.py
.js
.ts
.java
.jar
.php
.rb
.go
.lua
.rs
Keyboard Shortcuts
F5
Runs the current script and replaces the previous terminal started by this extension for the same file
Ctrl+F5
Runs the current script in a new VS Code integrated terminal while keeping existing terminals
Ctrl+Shift+F5
Runs the current script in a new system command window
Command Palette
You can also run these commands from the Command Palette:
Script Runner Terminal: Run Active Script (Replace Previous Run)
Script Runner Terminal: Run Active Script (New Terminal)
Script Runner Terminal: Run Active Script (External Window)
Execution Rules
.bat / .cmd
Executed with cmd.exe
.ps1
Executed with powershell.exe -NoExit -ExecutionPolicy Bypass
.py
Uses py -3 first, and falls back to python if needed
.js
Executed with node
.ts
Uses tsx first, and falls back to npx tsx if needed
.java
Compiles with javac first, then runs with java
.jar
Executed with java -jar
.php
Executed with php
.rb
Executed with ruby
.go
Executed with go run
.lua
Executed with lua
.rs
Uses cargo run when a Cargo.toml exists in the current or parent directory; otherwise compiles the single file with rustc and runs the generated executable
Notes
The shortcuts are only active when the current file is a saved local file
The extension saves the current file before running; if saving fails, execution is cancelled
The extension only manages terminals created by itself and does not close terminals opened manually
F5 only replaces the previous terminal associated with the current file and does not affect terminals for other files
Requirements
Different file types depend on the corresponding runtime or toolchain being installed on your machine:
.py requires py or python
.js requires node
.ts requires tsx, or npx tsx available in the project