How to change the MongoDB configuration file location in Windows?

The MongoDB service’s launching command path is stored in Windows Registry at the following path:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MongoDB\ImagePath

04

The configuration path is set as the --config argument of the launching command, e.g.:

C:\server\mongodb\bin\mongod.exe --config "C:\server\mongodb\cfg\mongod.cfg" --service

05

Set the proper value there, and then restart the service.

stackoverflow.com/a/7190551