Find cmder files when running as Administrator.

When starting a shell as Administrator, the CMDER_ROOT variable is
not propagated from the parent (non-Admin) environment.
Fix this by using paths relative to %ConEmuDir%.

Fixes issue #94.
This commit is contained in:
Greg Lucas 2014-03-13 11:48:50 -04:00
parent 7688823886
commit c76950293e
2 changed files with 6 additions and 1 deletions

View File

@ -488,7 +488,7 @@
<key name="Task1" modified="2013-11-29 16:19:41" build="131107"> <key name="Task1" modified="2013-11-29 16:19:41" build="131107">
<value name="Name" type="string" data="{cmd}"/> <value name="Name" type="string" data="{cmd}"/>
<value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/> <value name="GuiArgs" type="string" data=" /icon &quot;%CMDER_ROOT%\cmder.exe&quot;"/>
<value name="Cmd1" type="string" data="cmd /k &quot;%CMDER_ROOT%\vendor\init.bat&quot; -new_console:d:%USERPROFILE%"/> <value name="Cmd1" type="string" data="cmd /k &quot;%ConEmuDir%\..\init.bat&quot; -new_console:d:%USERPROFILE%"/>
<value name="Active" type="dword" data="00000000"/> <value name="Active" type="dword" data="00000000"/>
<value name="Count" type="dword" data="00000001"/> <value name="Count" type="dword" data="00000001"/>
<value name="Hotkey" type="dword" data="00000000"/> <value name="Hotkey" type="dword" data="00000000"/>

5
vendor/init.bat vendored
View File

@ -2,6 +2,11 @@
:: Sets some nice defaults :: Sets some nice defaults
:: Created as part of cmder project :: Created as part of cmder project
:: Find root dir
@if not defined CMDER_ROOT (
for /f %%i in ("%ConEmuDir%\..\..") do @set CMDER_ROOT="%%~fi"
)
:: Change the prompt style :: Change the prompt style
:: Mmm tasty lamb :: Mmm tasty lamb
@prompt $E[1;32;40m$P$S{git}$S$_$E[1;30;40m{lamb}$S$E[0m @prompt $E[1;32;40m$P$S{git}$S$_$E[1;30;40m{lamb}$S$E[0m