Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting cmder startup directory. #57

Closed
JPNaude opened this issue Nov 29, 2013 · 32 comments
Closed

Setting cmder startup directory. #57

JPNaude opened this issue Nov 29, 2013 · 32 comments

Comments

@JPNaude
Copy link

JPNaude commented Nov 29, 2013

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?

@Shoozza
Copy link
Contributor

Shoozza commented Nov 29, 2013

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

@JPNaude
Copy link
Author

JPNaude commented Nov 29, 2013

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 JPNaude closed this as completed Nov 29, 2013
@hmatijevic
Copy link

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

@thyme676
Copy link

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.

@danielzhang5566
Copy link

@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 :)

@ghost
Copy link

ghost commented Sep 12, 2017

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"

@akinhwan
Copy link

akinhwan commented Jan 9, 2018

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

@Stanzilla
Copy link
Member

@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

@marcbertola
Copy link

@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.

@cdtinney
Copy link

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?

@MalishenkoDV
Copy link

MalishenkoDV commented Feb 1, 2018

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 .

@essemario
Copy link

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.

@bertoost
Copy link

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"

@daxgames
Copy link
Member

daxgames commented Jan 13, 2019

@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.

@GF-Huang
Copy link

GF-Huang commented Apr 5, 2019

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

@daxgames
Copy link
Member

daxgames commented Apr 5, 2019

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

@GF-Huang
Copy link

GF-Huang commented Apr 5, 2019

image

I found a way.

@daxgames
Copy link
Member

daxgames commented Apr 5, 2019

Yup that is correct

@TomatoToaster
Copy link

TomatoToaster commented Apr 12, 2019

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!

@SteveLemire
Copy link

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

@daxgames
Copy link
Member

@SteveLemire that's a bit heavy handed as it will force that task to always open to that folder. Maybe that's what you want but it limits some other functionality.

You could just launch Cmder using a command line argument like cmder [folder path] or use a Windows shortcut and specify a working directory.

@afcanop
Copy link

afcanop commented Aug 9, 2020

@SteveLemire nice

@briansimiyuj
Copy link

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

Thank you

@ashnur
Copy link

ashnur commented Dec 13, 2020

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

It does say something about this issue that even after many years I still have to look this comment up to find that button.

@daxgames
Copy link
Member

I'll say this again. That's a bit heavy handed as it will force all tasks to always open to that folder. Maybe that's what you want but it limits some other functionality.

You could just launch Cmder using a command line argument like cmder [folder path] or use a Windows shortcut and specify a working directory.

@ashnur
Copy link

ashnur commented Dec 14, 2020

I'll say this again. That's a bit heavy handed as it will force all tasks to always open to that folder. Maybe that's what you want but it limits some other functionality.

Is this some magic behind the curtains that will break without me noticing or is this something that I can correct once it occurs? Because so far I didn't notice anything.

You could just launch Cmder using a command line argument like cmder [folder path] or use a Windows shortcut and specify a working directory.

This doesn't help when I use ctrl+t to open a new tab, right?

@daxgames
Copy link
Member

Is this some magic behind the curtains that will break without me noticing or is this something that I can correct once it occurs? Because so far I didn't notice anything.

Cmder.exe will open a session in a folder passed on the command line.

It has nothing to do with new tabs or ctrl+t

@ashnur
Copy link

ashnur commented Dec 14, 2020

Is this some magic behind the curtains that will break without me noticing or is this something that I can correct once it occurs? Because so far I didn't notice anything.

Cmder.exe will open a session in a folder passed on the command line.

It has nothing to do with new tabs or ctrl+t

Cmder exe is already running, I press ctrl+t and it open in scoop directory where cmder is installed, every damn time. I understand that with arguments or with additional commands, or with a different operating system on a different planet with different problems this would be solved differently. I am not sure about

  • your raising awareness comment about vague dangers of setting this setting, how dangerous it actually is, what I am breaking? Is there a place I could read up on this? I don't like to use issues as support mechanism.

  • just opening a new tab with a shortcut that is predefined, how to add additional arguments and so forth to that?

@daxgames
Copy link
Member

daxgames commented Dec 15, 2020

  1. I don't understand or appreciate the hostility, I do this for free on my free time to help people that like Cmder.

  2. I never said it was dangerous who said it was dangerous.

  3. What it breaks: Being able to open a cmder terminal in a designated folder using a command line option or a drive/folder Open Cmder Here context menu.

  4. I just said it was heavy handed and could possibly limit other functionality, see lalt + arrow left/right not working as a macro hotkey #3, unless you really do want every session to open in a specific folder every time.

  5. Edited: Cmder opens, by default, in the current working directory when cmder.exe is launched. If cmder is installed in the scoop folder and you are clicking on cmder.exe to launch that explains why subsequent sessions opens to that path.

    • If you create a shortcut and configure the 'Start In' folder as I suggested, shown below, then it becomes the default for Ctrl+t Start in unless you specify start in as a part of the task using -new_console:d:C:\ as suggested in the thread above which overrides everything for that task.

      image

  6. You can also do this from inside cmder to open a new tab in a specific folder cmder /single c:\windows unless you specify start in as a part of the task using -new_console:d:C:\.

  7. If its what you want do it.

Hopefully I have answered your questions. Let me know if not.

@ashnur
Copy link

ashnur commented Dec 15, 2020

I am sorry that you feel any kind of hostility, I want to assure you that was not my intent. Many thanks for the detailed answers, your analysis seems fully correct to me. It appears to me that picking any of the alternatives would be orders of magnitude much more work for something I don't use at the moment than what I do currently. I am also sorry about my first comment though, indeed the setting is not for what I thought it was. Should I edit my earlier comments to make this clear?

@daxgames
Copy link
Member

No problem. Whatever you want to do, I just wanted to makw syre you had answers to you queations.

@jhf
Copy link

jhf commented Nov 3, 2023

I found this page, frustrated that cmder always suggests a scoop path after pressing ctrl+t.
Finally it dawned on me, that this is caused by how cmder is installed by scoop, and henceforth invoked.

By right clicking the Cmder icon itself, the settings there reveal a "Start in" that sets the folder to "C:\Users$USER\scoop\apps\cmder\current".
Exiting Cmder fully, and then starting again, changes the default suggested startup directory.
Skjermbilde 2023-11-03 173758
This is not the "Startup dir" in the task setting, but rather the starting directory for Cmder itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests