This sounds like an issue with your environment variables rather than a problem with VS Code itself.
When you run the code command in Windows Command Prompt (cmd), Windows searches all commands on your path for one named code, and executes that command. VS Code installs a command with this name that opens the editor, normally located here on Windows:
C:\Program Files\Microsoft VS Code\bin
It may be that your path no longer contains this particular directory for some reason. You can edit your path directly to add it:
- From the Start menu, type "variables" and choose the option to "Edit environment variables for your account".
- Locate the PATH entry and edit it.
- Add the directory where the
code command exists, e.g. C:\Program Files\Microsoft VS Code\bin.
The path editor may appear slightly different depending on what version of Windows you are running.