ConEmu commands in task

2019-06-21 18:58发布

问题:

I'm trying to get a Task in ConEmu to open several consoles, and for each run a batch-like script when opened. For example:

  • Open a Git Bash, name the console "X", set the current directory to "Y".
  • Open another Git Bash and run a set of commands, for example "cd A/B/C", "vagrant up"
  • Open a regular command window, run the command "cd D/E/F", "grunt watch"

I want the second and third consoles to appear alongside each other, but underneath the first console. So far I am stuck getting commands to run; I have a task that runs the following:

"%ProgramFiles(x86)%\Git\bin\sh.exe" --login -i "-cur_console:n:t:Git Bash" "-cur_console:d:C:\Users\Ole Vik\dev"
"%ProgramFiles(x86)%\Git\bin\sh.exe" --login -i "-cur_console:s1TVn:t:Vagrant"
cmd "-cur_console:s2THn:t:Third"

Reading the ConEmu wiki led me to the new_console and cur_console switches, but I'm having trouble figuring out if I can somehow enter commands in the Task setup, or maybe if I can have it run a .bat script on each console.

回答1:

No colon is needed between switches (n & t for example).

cmd has /k switch to run commands.

I don't know the way to tell bash "run this command and stay in prompt". May be you need to run commands with &. I'm not sure about second line, you need to check it yourself.

"%ProgramFiles(x86)%\Git\bin\sh.exe" --login -i "-cur_console:nt:Git Bash" "-cur_console:d:C:\Users\Ole Vik\dev"
cmd -cur_console:s1TVnt:Vagrant /c vagrant up & "%ProgramFiles(x86)%\Git\bin\sh.exe" --login -i"
cmd -cur_console:s2THnt:Third /k cd /d "D\E\F" & grunt watch