66

I have Cmder for Windows it has default path c:\Users\ username and I want to change it to any other path I like or want. How do I change it ?

Also cmder can replace cmd.exe meaning is it possible to set cmder as default program insted of cmd.exe

cmder image

4
  • 2
    Did you tried to find information in docs? conemu.github.io
    – Maximus
    Oct 15, 2016 at 9:11
  • @ Maximus it is not conemu it is cmder and i tried searching docs but i didnt got it cmder.net Oct 15, 2016 at 11:51
  • 1
    @MandarSant ffs please stop saying this. I have had so many hair pulling experiences with trying to configure conemu with git or the above issue. reading the doc is not enough, because this is not an intended problem ffs
    – samayo
    Aug 16, 2019 at 23:35
  • 1
    I think it is bizarre that cmder doesn't use standard Linux/Unix terminology. User wants to specify $HOME folder. That should work across all shells available in CMDR. Instead, we have weird terminology "Startup dir". But it is not just a startup dir that user wants, user wants place where command like "cd" will always land.
    – pauljohn32
    Oct 14, 2020 at 17:51

5 Answers 5

114

As of cmder v1.3.6:

  1. Go to 'settings'

  2. In the settings group 'Startup', click on 'Tasks'

  3. Click the console you want to modify (e.g. cmd::Cmder, cmd::Cmder as Admin, bash::bash etc.)

  4. Click the button that says 'Startup dir...'

  5. Select the directory you want the console to start up in by default

  6. Enjoy

15
  • 2
    Works for Cmder version 1.3.10
    – jdhao
    Dec 21, 2018 at 11:25
  • 1
    Thanks, yes I haven't tested it for lower versions but it should be similar.
    – Moustache
    Dec 21, 2018 at 15:56
  • 1
    In fact, it is the latest version :)
    – jdhao
    Dec 22, 2018 at 1:57
  • 6
    It should be noted that this solution has side effect that "cmder here" contextual menu does not work anymore. It will always open the startup directory you have set up. See here for more information. sad :(
    – jdhao
    Dec 24, 2018 at 7:01
  • 4
    cmder v1.3.14. If you chose {cmd::Cmder as Admin} you may get the error *cmd is not recognized as an internal or external command, operable program or batch file. You will need to rearrange the command in the dialog window that is created for you from -new_console:d:C:\projects *cmd /k ""%ConEmuDir%\..\init.bat" " to *cmd /k ""%ConEmuDir%\..\init.bat" " -new_console:d:C:\projects . Oct 16, 2020 at 16:10
11

In the init.bat file in ~/cmder/vendor, before

:: Set home path

add

@cd /d "C:/YOUR_PREFERRED_FOLDER/"
4
  • i do not want to use cd when ever i open it the path which i have set should remain for ever after closing it also Oct 15, 2016 at 7:21
  • 1
    It will stay. You are adding this to your init.bat to force it set a new home path.
    – hiiambo
    Oct 15, 2016 at 21:04
  • where is init.bat file Oct 16, 2016 at 3:36
  • 2
    init.bat is in the ~/cmder/vendor directory.
    – Moustache
    Aug 1, 2018 at 15:38
9
  1. Create a shortcut to cmdr
  2. Edit the shortcut, change the "Start in" path to the desired path
  3. Profit
3
  • 1
    the easiest solution. :)
    – sybozz
    Jan 23, 2020 at 4:32
  • 3
    Best solution by far. Easiest & preserves the ability to "Open Cmder here" from context menu.
    – voxtm
    Apr 13, 2020 at 9:00
  • 2
    Doesn't work with mintty or bash, they can't find the path.
    – Ap0st0l
    May 6, 2020 at 17:48
2

For those who none of the above solutions worked (Cmder keeps reverting back to old path), here's what I did to fix it:

  1. Do a text search with Notepad++ in your Cmder directory for C:/OLD_FOLDER/
  2. Replace each found instance with your new directory: C:/YOUR_PREFERRED_FOLDER/.

For me, the issue was in ConEmu.xml which was preventing startup folder changes.

1

In cmder\vendor\init.bat there are these lines:

:: Set home path
if not defined HOME set "HOME=%USERPROFILE%"
%lib_console% debug_output init.bat "Env Var - HOME=%HOME%"

set "initialConfig=%CMDER_ROOT%\config\user_profile.cmd"
if exist "%CMDER_ROOT%\config\user_profile.cmd" (
    REM Create this file and place your own command in there
    %lib_console% debug_output init.bat "Calling - %CMDER_ROOT%\config\user_profile.cmd"
    call "%CMDER_ROOT%\config\user_profile.cmd"
)

So to change your default path for cmd.exe all you need to do is to edit your cmder\config\user_profile.cmd file and add something like this at its end:

if not defined CMDER_HOME set "CMDER_HOME=%HOME%"
cd %CMDER_HOME%

I'd recommend using a specific environment variable like %CMDER_HOME% because if you use the same cmder config on multiple hosts, you can set this environment variable to the appropriate directory on each host and use cmder with the exact same configuration. cmder provides a default value for %HOME%, as you can see above, so that seems to be a safe failback value (you get the same behaviour without that line too, but that's probably because the cd failed; which feels nicer to be avoided).

Also cmder can replace cmd.exe meaning is it possible to set cmder as default program insted of cmd.exe

I'm not sure what you mean by this. cmder is just a console emulator that nicely integrates other terminal emulators into its windows. One of these terminal emulators is cmd.exe. So cmder's purpose isn't really to replace cmd.exe, although most certainly you can just create a new tab in cmder whenever you would otherwise spin up a new cmd window. It would be probably useful to know where and why you'd like to use cmder by default instead of cmd?

1
  • 1
    I think he wants to make it his default command prompt... there's a registry setting for that.
    – Dagelf
    Sep 24, 2020 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .