Use -print-last-dir option for lfcd.cmd (#1444)

* exit lf not the cmd

* exit successfully

* use -print-last-dir
This commit is contained in:
Abderrahmane TAHRI JOUTI authored and GitHub committed 2023-10-22 20:43:03 +02:00
1 parent 154d7182c0
commit 1a3bcb28a1
1 file changed
+1 -10
+1 -10
View File
@@ -3,13 +3,4 @@ rem Change working dir in cmd.exe to last dir in lf on exit.
rem
rem You need to put this file to a folder in %PATH% variable.
:tmploop
set tmpfile="%tmp%\lf.%random%.tmp"
if exist %tmpfile% goto:tmploop
lf -last-dir-path=%tmpfile% %*
if not exist %tmpfile% exit
set /p dir=<%tmpfile%
del /f %tmpfile%
if not exist "%dir%" exit
if "%dir%" == "%cd%" exit
cd /d "%dir%"
for /f "usebackq tokens=*" %%d in (`lf -print-last-dir %*`) do cd %%d