Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Running GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) on Windows 7, the shell command (M-x shell) always creates a DOS box with the home directory. I've seen in other questions/answers that the default behaviour is to start a shell in the directory of the file in the current buffer, for example, Setting default working directory/drive in Emacs shell on Windows

I'm running from a limited user account, but this has not affected any other functions so far. Googling produced lots of information on how to switch to alternative shells, but I want to keep the normal DOS box. I just want to be able to start in the directory of the file that I'm viewing.

So which options need to be reconfigured?

share|improve this question
up vote 0 down vote accepted

This is most likely related to your configuration. Try starting Emacs without it (emacs -q) and see if the behavior is still the same. I guess that somewhere in your configuration the `default-directory' variable is set to either an invalid value or to your home directory. "M-: -> default-directory" will show you the current value.

share|improve this answer
Ok, that was weird. Your hints were enough to verify that it was definitely something to do with the start-up. The default-directory was set to my home directory but not when I started with -q. The config had no mention of directory settings so I just commented out everything except the custom-set-variables, started uncommenting things step-by-step to find the problem. After uncommenting everything, the default-dir is still ok and I can 'M-x shell' to the correct directory. Perhaps there was some problem with hidden characters. Regardless, the problem is solved. Thanks for your help! – tiktok Dec 31 '12 at 9:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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