Open a Folder in VS Code from the Terminal (code .)
Launch Visual Studio Code on the current directory using its built-in command-line interface.
01Command
$ code .02What it does
The code command ships with VS Code: code . opens the current folder, code file.txt opens a single file, and code -r . reuses the last window instead of a new one. If the command is not found, Windows users should relaunch the terminal after ticking "Add to PATH" in the installer, or run the installer's repair option. This also works inside the VS Code integrated terminal for opening sibling folders quickly.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- Command Line Interface (VS Code)Evidence: Documents the code CLI: code . opens the current folder, code file.txt opens files, and flags like -r/-n/-d control window reuse.
Last verified: 2026-09-18 · Category: Developer
06Related solutions
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
One pipeline that renames every matching file in a folder using regular expressions — safer and far more flexible than third-party renamers.