In order to be able to launch VS Code from Terminal on Mac or Command Line in Windows do this:

Open VS Code and open the Command Palette (Shift + command + P) on Mac or (Shift + Control + P) on Windows.

Find and select the Shell Command: Install ‘code’ command in PATH command.

When you execute this, then you need to restart your Terminal window and then the path will be effective.

Then you can go to any folder and type code. Now VS Code will open in that directory.