Created
December 15, 2021 11:47
-
-
Save abdes-zakari/b200c85c2aa43ca921a25e47629f5422 to your computer and use it in GitHub Desktop.
Windows: get symbolic link target
This file contains 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
@echo off | |
rem Windows: get symbolic link target | |
rem cmd: get_sym_target.bat <dir> <folder|file> | |
rem for /f "tokens=2 delims=[]" %%H in ('dir /al %1 ^| findstr /i /c:"%2"') do ( | |
rem echo %%H | |
rem ) | |
rem cmd: get_sym_target.bat <folder|file> // current directory | |
for /f "tokens=2 delims=[]" %%H in ('dir /al . ^| findstr /i /c:"%1"') do ( | |
echo %%H | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PowerShell (PSv5+) solutions:
List all links and their targets in the current directory as full paths:
Get-ChildItem | ? Target | Select-Object FullName, Target