ConEmu Environment variables
- List of environment variables set by ConEmu
- PATH modifications
- Debug purposed variables
- Export variables
- Disabling hooks temporarily
- Cheating system time
- ConEmuCpCvt - hack to force output CP conversion
- ConEmuDefaultCp - hack to change output CP if you don’t want to use ‘chcp’
List of environment variables set by ConEmu
||folder, containing ConEmu.exe|
||drive letter with colon, containing ConEmu.exe|
||folder, containing ConEmuC.exe|
||same as ConEmuBaseDir, but using short names (e.g.
||folder, from where your shell was started|
||drive letter with colon, from where your shell was started|
|ConEmuArgs||vary||arguments were specified to ConEmu.exe|
|ConEmuConfig||vary||current configuration name, see
||current ConEmu build number|
|ConEmuPID||number||PID (process ID) of ConEmu GUI|
|ConEmuServerPID||number||PID (process ID) of ConEmuC server executable|
||main ConEmu window handle|
||virtual console window handle (child window of ConEmu), this is canvas for console text painting|
||backing for canvas, it may be larger than canvas if padding or scrollbars exists|
||set for those tabs/splits which were started elevated (UAC)|
||set by ConEmu to
||you may temporarily disable injects when running ‘long’ batches or initialization scripts|
||will cheat system and local current time for console processes|
|ConEmuMacroResult||vary||may be set only by ConEmu’s Far Manager plugin after executing GUI Macro|
||to force output CP conversion|
||to change output CP if you don’t want to use chcp|
Settings page Environment has an options ‘Add %ConEmuDir% to %PATH%’, ‘Add %ConEmuBaseDir% to %PATH%’ and edit box for settings user-defined environment variables.
%ConEmuBaseDir% are set by default to allow easily run
executables and scripts and macros from ConEmu’s folders. For example:
ConEmuC -GuiMacro Progress 3
csudo dism.exe /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess
Debug purposed variables
||Turns on monitoring feature of ‘Sleep in background’, when
||Shows message box like ‘perl.exe loaded’ when
When you start new console - it inherits environment strings (
from parent process (ConEmu GUI).
When you change %PATH% in your shell - it applies to this shell and its children processes (that is started in current console/tab).
If you need to fixate this temporarily environment changes - you may execute
ConEmuC /export PATH
This will ‘copy’ your current
%PATH% value to ConEmu GUI
and it will be applied to all new ConEmu’s consoles.
Full syntax of Export command
ConEmuC /EXPORT[=CON|ALL] [Var1 [Var2 [...]]] ConEmuC /export[=CON|ALL] [Var1 [Var2 [...]]] VarN - may contains one trailing/middle asterisk (sort of filemask support). /export - export to all processes of current console and ConEmu GUI /export=CON - export to all processes of current console only /export=GUI - export to ConEmu GUI only /export=ALL - export to all processes of opened tabs and ConEmu GUI
- Note! ‘Inject ConEmuHk’ required to set variables.
- Some shells may ignores environment changes by
/EXPORT=ALLbecause of their features.
- Shells comments
- ‘Far Manager’ & ‘TCC/LE’ - OK;
- ‘cmd’ - fails partially (required to run smth from active cmd, for example “cmd /k exit”, to ‘apply’ changes);
- ‘bash’ - fails completely (seems, it does not support outside changing of env.vars).
Disabling hooks temporarily
You may temporarily disable injects when running ‘long’ batches or initialization scripts:
cmd /k set ConEmuHooks=OFF & "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" -new_console:sV -new_console:t:SDK & set ConEmuHooks=
ConEmuHooks may be set to comma-delimited set of
NOSTART or simple
So if you want temporarily disable processing of
(which both are forcing command into the new ConEmu tab)
you may set the following:
Cheating system time
Environment variable “ConEmuFakeDT”. That will cheat system and local current time for console processes. Use carefully! Console applications will think that time was freezed! ‘Inject ConEmuHk’ must be on! Some examples (cmd):
set ConEmuFakeDT=%DATE% %TIME% set ConEmuFakeDT=2013-12-31T23:59:59.99 set ConEmuFakeDT=2013-01-31 9:0:0 set ConEmuFakeDT=2013-11-30
Codepage hack to force output CP conversion.
If some command uses wrong CP while converting ANSI to Unicode
(the example may be perl.exe from
git add -p)
set variable to correct its output. Use asterisk for all apps.
This hack affects ONLY
WriteConsoleW function calls.
Format: <exename>:<badcp>:<goodcp>[;<exename>:<badcp>:<goodcp>[...]] Example: set ConEmuCpCvt=perl.exe:1252:1251;*:850:866;
Codepage hack to change output CP if you don’t want to use chcp.
If you can’t use
chcp <codepage> to change whole console CP output,
you may change it using environment variable ConEmuDefaultCp.
It will affect only
So, if you need to run several apps in one console simultaneously…
set ConEmuDefaultCp=1251 ConEmuC -fork -c App1.exe set ConEmuDefaultCp=866 ConEmuC -fork -c App2.exe set ConEmuDefaultCp=