If you run code --help
, you'll see "Usage: code [options][paths...]
".
So just run code <file path 1> <file path 2> <file path 3> <...>
in whatever shell of your choice. Make sure to use shell-appropriate quoting if any of the file paths have spaces in them. And you can use relative paths relative to the current working directory of the shell.
If you already have a VS Code window open, doing so will open those files in the existing window. If you want to open them in a new VS Code window, use the -n
(also aliased as --new-window
) flag.
Note also that the File > Open
mechanism supports opening multiple files at the same time. You'll have to use whatever keyboard modifiers are used by your platform (OS)'s native File Explorer application, but usually, it's holding ctrl/cmd to add a single item to the selection, and holding shift to add a range of consecutive items to the selection.