cmder icon indicating copy to clipboard operation
cmder copied to clipboard

Setting cmder startup directory.

Open JPNaude opened this issue 13 years ago • 32 comments

I'm trying to change the directory in which cmder starts up. To do this, I just added the following to the end of my init.bat file:

cd D:/work
d:

Its not very elegant but it works, and it prints some funny message as the first line of text:

image

Is there a better way to do this? Or at least get rid of the first line message?

JPNaude avatar Nov 29 '13 03:11 JPNaude

Looks like you saved the init.bat file as UTF-8 with BOM try to save it without BOM

You could switch in one command with: cd /d D:\work

Shoozza avatar Nov 29 '13 04:11 Shoozza

Thanks that fixed it. Not sure why the BOM was saved, I opened in Notepad++ and my settings is set not to save with BOM. However, opening the file in VIM showed the characters.

JPNaude avatar Nov 29 '13 06:11 JPNaude

Instructions: Open Cmder -> Settings -> Tasks -> select {cmd::Cmder} (in my case). On the bottom (below textarea) you have button named "Startup dir...", and than select startup directory. Close cmder, and start again. That's it, enjoy

hmatijevic avatar Aug 16 '16 08:08 hmatijevic

While hmatijevic's tip was helpful, it took me a while to process as a Cmder noob. In the last step, replace %USERPROFILE% with N:\ where N:\ is the drive or location you wish to start in.

thyme676 avatar Jan 31 '17 00:01 thyme676

@hmatijevic very helpful,thanks! But one thing must be noticed is that we should delete the default startup directory setting before clicking the "Startup dir..." bottom.

In my case,the default {cmd::Cmder} looks like this: cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:%USERPROFILE% Then,i change to this: cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:G:\myfoldername

It works great :)

danielzhang5566 avatar Jul 07 '17 07:07 danielzhang5566

Click Settings -> Startup -> Tasks Select the first Predefined task, in my case {Shells::cmd} On the right, under Task parameters, enter e.g.: /dir "c:\github"

ghost avatar Sep 12 '17 16:09 ghost

Interestingly enough Under "Startup directory for new process:" it still says a different directory than what actually initiates in a new cmder tab...huh oh well

akinhwan avatar Jan 09 '18 21:01 akinhwan

@akinhwan can you try the latest master build and tell me if it is better now? https://ci.appveyor.com/project/MartiUK/cmder/build/1.0.521-master/artifacts

Stanzilla avatar Jan 10 '18 11:01 Stanzilla

@Stanzilla, in case you were still looking for feedback about your last post: I was running into this issue with 1.3.3, and 1.3.4, but the build you posted above works for me.

marcbertola avatar Jan 17 '18 20:01 marcbertola

This doesn't seem to work for me:

cmd /k "%ConEmuDir%\..\init.bat" -new_console:d:C:\foo

It still opens in %USER_PROFILE%. Any suggestions?

cdtinney avatar Jan 26 '18 03:01 cdtinney

try this: for bash::Git bash : Changing program startup folder in settings —> task, choose btn "startup dir..." and placing necessary directory. You can place checkbox "Default task for new console" and put a hotkey. Using this hotkey - new "bash::Git bash" tab will be opened whis YOUR_PATH .

MalishenkoDV avatar Feb 01 '18 21:02 MalishenkoDV

Edit the file: \CMDER_DIRECTORY\config\user-profile.cmd

d:
cd Work

On bellow example, I've changed the directory and created a rotine to start homestead.

:: use this file to run your own startup commands
:: use  in front of the command to prevent printing the command

:: uncomment this to have the ssh agent load when cmder starts
:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-agent.cmd"

:: uncomment this next two lines to use pageant as the ssh authentication agent
:: SET SSH_AUTH_SOCK=/tmp/.ssh-pageant-auth-sock
:: call "%GIT_INSTALL_ROOT%/cmd/start-ssh-pageant.cmd"

:: you can add your plugins to the cmder path like so
:: set "PATH=%CMDER_ROOT%\vendor\whatever;%PATH%"

e:
cd ../../../../../Homestead

@echo off

:Ask
echo Would you like to start the Homestead?(Y/N)

set INPUT=
set /P INPUT=Yes(y) ou No(n): %=%
If /I "%INPUT%"=="y" goto yes 
If /I "%INPUT%"=="Y" goto yes 
If /I "%INPUT%"=="n" goto no

cls
echo Invalid option
echo - 
echo -
goto Ask

:yes
vagrant up
goto finalMessage

:no 
cls
goto finalMessage

:finalMessage
echo Your console is ready Mr. Chapela.

essemario avatar Apr 12 '18 20:04 essemario

Instructions: Open Cmder -> Settings -> Tasks -> select {cmd::Cmder} (in my case). On the bottom (below textarea) you have button named "Startup dir...", and than select startup directory. Close cmder, and start again. That's it, enjoy

Too bad this is working, but then the "Open CMDer here" from the context menu (windows) isn't working anymore. It is forced to the startup directory all the time. I would like to set a default directory to start when not using "Open CMDer here"

bertoost avatar Jan 13 '19 13:01 bertoost

@bertoost don't set that setting. Cmder is a package of 4 different products each with its own individual settings that sometimes conflict. Cmder.exe will open in the current working directory or a directory you supply on the command line. If you want cmder to launch from a shortcut in a certain folder every time configure the shortcut start directory instead. Cmder here will continue to work as expected this way.

daxgames avatar Jan 13 '19 14:01 daxgames

@daxgames Is there any solutions working both Cmder here and set a default directory to start when not using "Open CMDer here" ?

GF-Huang avatar Apr 05 '19 12:04 GF-Huang

Cnder.exe will open in the current working directory by default or you can 'cmder folder-name'

daxgames avatar Apr 05 '19 13:04 daxgames

image

I found a way.

GF-Huang avatar Apr 05 '19 13:04 GF-Huang

Yup that is correct

daxgames avatar Apr 05 '19 13:04 daxgames

Wow, today I learned that Windows shortcuts let you choose where to start a program in them. Setting it to %USERPROFILE% did exactly what I wanted. Thanks!

TomatoToaster avatar Apr 12 '19 11:04 TomatoToaster

If you don't want to open a new console, you can do this:

  • open cmder settings
  • under Startup / Tasks, select you default task ({cmd::Cmder})
  • in the "Task parameters", add /dir with you cmder default path: /dir "C:\CmderDirectory"
  • Save settings

image

SteveLemire avatar May 27 '20 17:05 SteveLemire