3

In Linux we would do the following:

$ /var/mongodb/bin/mongod

I'm trying to do the following in windows but it just isn't working:

C:\>C:\Program Files\MongoDB\Server\3.2\bin\mongodb --dbpath \var\data
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Also tried:

C:\>"C:\Program Files\MongoDB\Server\3.2\bin\mongodb" --dbpath \var\data
'"C:\Program Files\MongoDB\Server\3.2\bin\mongodb"' is not recognized as an internal or external command,
operable program or batch file.
3
  • @SeanClt Tried, still not working :/ – Karl Morrison Mar 23 '16 at 12:45
  • @SeanClt Ah, it did work, the command is mongod not mongodb, post an answer I'll accept! – Karl Morrison Mar 23 '16 at 12:46
  • Does it work if you run the command from the directory there the executable exists? If not, then there may be more than a path issue. – CharlieRB Mar 23 '16 at 12:49
3

When there are spaces in the path it needs to be added between quotes

C:>"C:\Program Files\MongoDB\Server\3.2\bin\mongod" --dbpath \var\data

Normally if you are getting an error like "'C:\Program' is not recognized " it's path issue because windows is not liking the space between Program and Files

One way to avoid this type of mistake can be done by writing the command on command prompt and using TAB key to auto complete. meaning you type C:\Program then hit TAB and it will auto complete with quote and you can do it for the rest of the path too by typing \ this avoid spelling mistakes and you can easily make sure the files do exist

1
  • 1
    @CharlieRB It was mongod not mongodb, he also helped with the quotes :) – Karl Morrison Mar 23 '16 at 12:51
0

If I understood this correctly, you want to run a command prompt from a specific folder?

To do that, all you do is hold down the SHIFT key in the folder you want your command prompt to open to, right-click and select "Open command window here". You don't have to type anything

1
  • I understand what your saying, but I'm from linux so I'm more a terminal person. Also I write scripts sometimes and would like the scripts to be able to run the correct command wherever the file is! – Karl Morrison Mar 24 '16 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.