Home > database >  VS Code command "code -v" doesn't work as expected
VS Code command "code -v" doesn't work as expected

Time:10-08

When I launch the "code" command (VS Code) with optional arguments (CLI options), from Cmd (or any other CLI) it opens VS Code instead of giving me the awaited result.

For ex. if I type "code -v", or "code --version", instead of telling me the version, it opens VS Code. Same if I type "code -h" or "code --help". (Appart from that, everything is working fine, for ex. if I type "code .", or "code bogus.txt".)

I am on Windows 10, with Vs Code installed in portable mode. Of course the directory in which I installed Vs Code is in my Path environment variable.

I resarched some answers but couldn't find anybody that documented the same problem I am facing.

CodePudding user response:

You are most probably calling something like

(wrong)
C:\apps\VSCode\code --version

what does not work.

Make sure that VSC executable in your path is from the /bin/ folder, not its parent, i.e.:

where code

returns something like

C:\apps\VSCode\bin\code
C:\apps\VSCode\bin\code.cmd

You can verify that before altering your path environment variable by calling

(correct)
C:\apps\VSCode\bin\code --version
  • Related