add cd scripts for cmd.exe and powershell

This commit is contained in:
Gokcehan committed 2017-10-21 21:00:10 +03:00
1 parent 098332fc05
commit fd2d3a0f86
2 files changed
+30

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
# Change working dir in powershell to last dir in lf on exit.
#
# You need to put this file to a folder in $ENV:PATH variable.
$tmp = [System.IO.Path]::GetTempFileName()
lf -last-dir-path="$tmp" $args
if (test-path -pathtype leaf "$tmp") {
$dir = type "$tmp"
remove-item -force "$tmp"
if (test-path -pathtype container "$dir") {
if ("$dir" -ne "$pwd") {
cd "$dir"
}
}
}