Last active
December 20, 2015 09:59
-
-
Save snipsnipsnip/6112434 to your computer and use it in GitHub Desktop.
pushd-shortcut.bat: ショートカットの飛び先を読み取ってそこまでpushdする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if exist "%~f1" @( | |
echo pushd "%~f1" | |
pushd "%~f1" | |
) else @for %%i in (%1.lnk) do @( | |
for /f %%n in ('perl -x "%~f0" %%~$path:i') do @( | |
echo pushd %%n | |
pushd %%n | |
) | |
) | |
@exit /b | |
#!perl | |
use strict; | |
use Win32::Shortcut; | |
use File::Basename qw/dirname/; | |
exit 1 unless @ARGV && -e $ARGV[0]; | |
my $link = Win32::Shortcut->new(); | |
$link->Load($ARGV[0]); | |
print -d $link->{'Path'} ? $link->{'Path'} : dirname $link->{'Path'}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment