Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting mongodb editor path in mongorc on windows

I'm trying to set the path to sublime text editor for mongodb in the .mongorc.js on windows 8 so I add this line to .mongorc.js ...

EDITOR = "C:\\Program Files\\Sublime Text 3\sublime_text.exe";

which when I start mongo.exe from the command prompt and then type:

> edit blah

it returns:

'C\Program' is not recognized as an internal or external command

so I try

EDITOR = "C:\\Program\u0020Files\\Sublime\u0020Text\u00203\\sublime_text.exe";

and even

EDITOR = "C:\\Program%20Files\\Sublime%20Text%203\\sublime_text.exe";

and I get

The system cannot find the path specified.

like image 800
maehue Avatar asked Jan 12 '23 21:01

maehue


1 Answers

You can have spaces in your editor name, you just have to be sure to escape everything properly. I don't have the editor you have installed, so I used wordpad.

> EDITOR="\"C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe\""
"C:\Program Files\Windows NT\Accessories\wordpad.exe"
> edit a

works for me. You need to enclose the whole thing in quotes, and then backslash escape backslashes and double quotes around the entire executable.

You can also make sure the path to your editor is in your default/system path, then you only need to assign the editor executable name to EDITOR.

like image 142
Asya Kamsky Avatar answered Jan 22 '23 07:01

Asya Kamsky