mirror of
https://github.com/wting/autojump
synced 2024-10-27 20:34:07 +00:00
fixed batch variable handling
This commit is contained in:
parent
53eeed8a99
commit
1d13c0d4ae
14
bin/j.bat
14
bin/j.bat
@ -1,15 +1,21 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
echo %*|>nul findstr /rx \-.*
|
echo %*|>nul findstr /rx \-.*
|
||||||
if ERRORLEVEL 1 (
|
if ERRORLEVEL 1 (
|
||||||
for /f %%G in ('python %~dp0\autojump %*') do set new_path=%%G
|
for /f %%i in ('python %~dp0\autojump %*') do set new_path=%%i
|
||||||
if exist %new_path%/nul (
|
if exist !new_path!\nul (
|
||||||
cd %new_path%
|
echo !new_path!
|
||||||
|
pushd !new_path!
|
||||||
|
REM endlocal is necessary so that we can change directory for outside of this script
|
||||||
|
REM but will automatically popd. We mush pushd twice to work around this.
|
||||||
|
pushd !new_path!
|
||||||
|
endlocal
|
||||||
|
popd
|
||||||
) else (
|
) else (
|
||||||
echo autojump: directory %* not found
|
echo autojump: directory %* not found
|
||||||
echo try `autojump --help` for more information
|
echo try `autojump --help` for more information
|
||||||
)
|
)
|
||||||
echo %new_path%
|
|
||||||
) else (
|
) else (
|
||||||
python %~dp0\autojump %*
|
python %~dp0\autojump %*
|
||||||
)
|
)
|
@ -1,15 +1,15 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
echo %*|>nul findstr /rx \-.*
|
echo %*|>nul findstr /rx \-.*
|
||||||
if ERRORLEVEL 1 (
|
if ERRORLEVEL 1 (
|
||||||
for /f %%G in ('python %~dp0\autojump %*') do set new_path=%%G
|
for /f %%i in ('python %~dp0\autojump %*') do set new_path=%%i
|
||||||
if exist %new_path%/nul (
|
if exist !new_path!\nul (
|
||||||
start %new_path%
|
start !new_path!
|
||||||
) else (
|
) else (
|
||||||
echo autojump: directory %* not found
|
echo autojump: directory %* not found
|
||||||
echo try `autojump --help` for more information
|
echo try `autojump --help` for more information
|
||||||
)
|
)
|
||||||
echo %new_path%
|
|
||||||
) else (
|
) else (
|
||||||
python %~dp0\autojump %*
|
python %~dp0\autojump %*
|
||||||
)
|
)
|
Loading…
Reference in New Issue
Block a user