1

When i enter this in ConEmu:

gvim --windowid %ConEmuBackHWND% -new_console:sH

I get a blank split that after a while says the following:

GUI application (PID=384) was attached to ConEmu:
\Path\To\gvim.exe

While trying to find out what was going wrong i made a "Gvim" task with the following command contents:

gvim --windowid %ConEmuBackHWND% -new_console:sH

(Same as the command i entered above in the command line)
And when i know start the task from the "Create new console" dialog, everything works fine and i get a gvim child window as my right split!

How are the commands being executed from the "Create new console" dialog, and how can i make the above command to spawn a gvim split directly from the console?

1

ProcessExplorer is very helpful tool to detect problems with environment variables and things... I think you have problem because of variable expansion. Try following

gvim --windowid !ConEmuBackHWND! -new_console:sH

When you run the command with percent signs, the CLI replace variables before ConEmu get the command. So, you were trying to run gvim in new split, but telling it HWND from old split.

When you use exclamation signs, variables are not expanded, ConEmu gets the command untouched, and the !ConEmuBackHWND! is expanding by ConEmu itself in proper moment, after split is created and new variables initialized.

  • That worked! I didn't know that EnableDelayedExpansion was enabled by default. Would you mind explaining why you believe that the problem happened? – Fr0stBit Sep 12 '15 at 1:15
  • Answer updates, exclamation signs are expanded by ConEmu itself. – Maximus Sep 12 '15 at 11:53
  • Fantastic! Thank you for the explanation. I am still wondering though why the normal environment variable expansion worked with the Task execution. I suppose that it is the same logic as above, the child window is being created with some WinAPI functions and then the command is being expanded in the new window directly, am i right? – Fr0stBit Sep 12 '15 at 11:59

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.