mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 09:49:12 +08:00
Fix Cmder not changing to CMDER_START (#1399)
* Fix Cmder not changing to CMDER_START Fix to allow Cmder to change to different startup directory if already on the same drive as CMDER_START possibly relevant: HOME != USERPROFILE * make "Cmder Here" work in more cases integrated suggestion from comments (test for trailing backslash to prevent doubling of trailing backslash) integrated suggestions from #1456: switching ```cd /d``` over to ```pushd``` to get support for UNC-paths * replaced 'cd /d' with 'pushd' replaced two more instances of 'cd /d' with 'pushd' to support network paths. Also added double quotes to the use of '%USERPROFILE%' to prevent issues with spaces. I also noticed that 'pushd', in contrast to 'cd /d' does not require the trailing backslash for drive roots (on Win7). Therefore I removed the trailing backslash check. * Don't assume / is needed at end * Update init.bat
This commit is contained in:
parent
e9a78a30d1
commit
22d27afed5
13
vendor/init.bat
vendored
13
vendor/init.bat
vendored
@ -149,9 +149,9 @@ call "%user-aliases%"
|
|||||||
:: manually extracting the archive rather than executing the 7z sfx
|
:: manually extracting the archive rather than executing the 7z sfx
|
||||||
if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
|
if exist "%CMDER_ROOT%\vendor\git-for-windows\post-install.bat" (
|
||||||
call :verbose-output Running Git for Windows one time Post Install....
|
call :verbose-output Running Git for Windows one time Post Install....
|
||||||
cd /d "%CMDER_ROOT%\vendor\git-for-windows\"
|
pushd "%CMDER_ROOT%\vendor\git-for-windows\"
|
||||||
"%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
|
"%CMDER_ROOT%\vendor\git-for-windows\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
|
||||||
cd /d %USERPROFILE%
|
pushd "%USERPROFILE%"
|
||||||
)
|
)
|
||||||
|
|
||||||
:: Set home path
|
:: Set home path
|
||||||
@ -159,10 +159,15 @@ if not defined HOME set "HOME=%USERPROFILE%"
|
|||||||
|
|
||||||
:: This is either a env variable set by the user or the result of
|
:: This is either a env variable set by the user or the result of
|
||||||
:: cmder.exe setting this variable due to a commandline argument or a "cmder here"
|
:: cmder.exe setting this variable due to a commandline argument or a "cmder here"
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
if defined CMDER_START (
|
if defined CMDER_START (
|
||||||
cd /d "%CMDER_START%"
|
if "%CMDER_START:~-1%" neq "\" (
|
||||||
)
|
SET "CMDER_START=%CMDER_START%\"
|
||||||
|
)
|
||||||
|
|
||||||
|
pushd "!CMDER_START!"
|
||||||
|
)
|
||||||
|
endlocal
|
||||||
|
|
||||||
if exist "%CMDER_ROOT%\config\user-profile.cmd" (
|
if exist "%CMDER_ROOT%\config\user-profile.cmd" (
|
||||||
REM Create this file and place your own command in there
|
REM Create this file and place your own command in there
|
||||||
|
Loading…
Reference in New Issue
Block a user