1valdis
1valdis

Reputation: 1104

How to make custom global command in VS Code terminal?

I just installed MongoDB. Instead of writing annoying cd to mongod.exe every time I want to run MongoDB, I want this file to be available as a global command, so that it runs regardless of the directory I'm in, like node or npm or git. How do I accomplish this for VS Code terminal?

Upvotes: 0

Views: 384

Answers (1)

HaaLeo
HaaLeo

Reputation: 11672

There are different approaches to start mongod.exe:

  1. You could add mongod.exe to your system's PATH variable (like git, npm etc.)

  2. You could create a script (for example a .bat) file in your workspace directory, that contains

    Start "path/to/mongod.exe"
    
  3. If you want to start the mongod.exe via a vscode command like Strg + P for the user settings, you need to write an extension and register a command.

Upvotes: 1

Related Questions