Skip to content

Commit

Permalink
use -print-last-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
atahrijouti authored Sep 27, 2023
1 parent 83919cb commit 5aa07b4
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions etc/lfcd.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5aa07b4

Please sign in to comment.