I'm currently trying to set up my environment such that I can open a ConEmu tab and it will automatically initialize Far Manager and the VS Developer Command Prompt environment.

My failed attempt was this:

cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64_x86 & far -new_console:d:C:\My\Code

This works in that it accomplishes what I want, but ConEmu doesn't like it because it leaves an active cmd.exe instance, so when you try to close the tab you will always get a warning, which is not ideal.

If you've never seen this before, this is what pops up on tab closure if you use the above task:


After a whole bunch of searching I found this link which contains a comment at the bottom by the ConEmu author:


He says this:

Yep, that is working. But this method left cmd.exe in your working process tree.

Another way - run vcvarsall.bat from you shell (PowerShell or Far Manager) and export changed environment from cmd to the parent process. The advantage - you can set up different settings at run time.

Description: https://code.google.com/p/cone...

And example command (I'm using that from Far Manager): "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 & "%ConEmuBaseDir%\ConEmuC.exe" /export=CON

The problem with this however is that I have to run this command manually after running far. I can't seem to find a way to automatically run that command after initializing Far.

It's not really a viable solution to do it manually because I have so many different environments to set up. Consider that I want a different tab for each compiler I'm using (MSVC, Clang, GCC, Intel C++ - sometimes multiple version of each, and pretty much always multiple architectures).

Basically I need a way to set up a task such that I can either run a batch file, followed by Far (so it inherits the env vars) without leaving a dangling cmd.exe instance. Or, I need to be able to set up a task such that I can automatically run a command (different per task) after running Far.

I'm pretty sure there would be some black magic way to do it, but I'm not familiar enough with ConEmu/Far yet to figure it out.

If I get super desperate I'll probably end up writing a plugin, but I'd rather avoid that if I can.

  1. ConEmu has forking abitily. So, you may just call

    -new_console:d:C:\My\Code cmd.exe /c ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64_x86 & ConEmuC -fork -c far"
  2. Far Manager has its own Macro system. You may either set up "Auto started" macro, or just pass it via command line. Consider proper quotation! Just change F2 F1 to your keys sequence. Easies way is adding required command to the F2 (User Menu).

    -new_console:d:C:\My\Code cmd.exe /c ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64_x86 & far "lua:Keys(\"F2 F1\")""
  • Running the first command appears to break Far for me. For example, instead of Ctrl+O toggling the view I just get "^O" at the prompt. (It also continues to suffer from the same problem of causing a prompt when closing the tab, but I'm assuming that's related to the first issue.) – RaptorFactor May 23 '16 at 20:11
  • 1
    Not /k but /c! – Maximus May 24 '16 at 9:28
  • That causes the tab to stay open with an error message on close, but at least there is no popup so I can probably live with that. :) "ConEmuC: Root process was alive less than 10 sec, ExitCode=x00000103(259). Press Enter or Esc to close console..." Thanks so much for your awesome project. – RaptorFactor May 24 '16 at 21:52
  • 1
    Another documented switch: -new_console:n – Maximus May 25 '16 at 13:02

I made this by combining two predefined monstrous commands for {Far} and for {SDK::VS 15.0 x64 tools prompt} using &&:

-new_console:t:"VS 15.0" -new_console:C:"%CommonProgramFiles(x86)%\microsoft shared\MSEnv\VSFileHandler.dll,38" cmd /c ""%ConEmuDrive%\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 && set "FARHOME=" & "%ConEmuDir%\..\Far Manager\far.exe" /w /p"%ConEmuDir%\Plugins\ConEmu;%FARHOME%\Plugins;%FARPROFILE%\Plugins""

Settings screenshot


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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