The following command:
c:\SitesData\survey.unifocus.com\mongo\mongod.exe --rest --replSet rsUfSurvey --dbpath C:\SitesData\survey.unifocus.com\mongodata_test27022\ --serviceName Mongo27022 --serviceDisplayName "MongoDB 27022" --serviceDescription "Instance of mongod.exe listening on TCP port 27022" --logpath C:\SitesData\survey.unifocus.com\mongo_27022.log --logappend --port 27022 --install
creates a service with a HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MongoDB\ImagePath value of:
"c:\SitesData\survey.unifocus.com\mongo\mongod.exe" --rest --replSet rsUfSurvey --dbpath "C:\SitesData\survey.unifocus.com\mongodata_test27022\" --logpath "C:\SitesData\survey.unifocus.com\mongo_27022.log" --logappend --port 27022 --service
When atetmpting to start the service using NET START Mongo27022, the following error message is given:
The service is not responding to the control function.
If I try to manually run the ImagePath value without "--service" on the end, I get the following error:
Fri Mar 30 08:57:05 [initandlisten] exception in initAndListen: 10296 dbpath (C:\SitesData\survey.unifocus.com\mongodata_test27022" --logpath C:\SitesData\survey.unifocus.com\mongo_27022.log --logappend --port 27022) does not exist, terminating
Evidently, the backslash at the end of the dbpath is being treated as an escape sequence and preventing the quotes (which were added automatically by --install !) from closing correctly.
A suitable workaround is obviously to not put a backslash character at the end of the dbpath, but it definitely had me scratching my head for a bit!