From 5aa07b4429bff173a3419d0d82af6763665ad77e Mon Sep 17 00:00:00 2001 From: Abderrahmane TAHRI JOUTI <302837+atahrijouti@users.noreply.github.com> Date: Wed, 27 Sep 2023 19:47:44 +0200 Subject: [PATCH] use -print-last-dir --- etc/lfcd.cmd | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/etc/lfcd.cmd b/etc/lfcd.cmd index e17d378d..ce23dd64 100644 --- a/etc/lfcd.cmd +++ b/etc/lfcd.cmd @@ -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 0 -set /p dir=<%tmpfile% -del /f %tmpfile% -if not exist "%dir%" exit 0 -if "%dir%" == "%cd%" exit 0 -cd /d "%dir%" +for /f "usebackq tokens=*" %%d in (`lf -print-last-dir %*`) do cd %%d