windows symbolic link target

前端 未结 6 1060
死守一世寂寞
死守一世寂寞 2020-12-13 19:48

Say that I set up a symbolic link:

mklink  /D C:\\root\\Public\\mytextfile.txt C:\\root\\Public\\myothertextfile.txt

Editor\'s note: O

6条回答
  •  遥遥无期
    2020-12-13 20:38

    all credits to @SecurityAndPrivacyGuru , [cmd]

    complete batch script/function that reads symlink{|s in folder} and outputs list with them and their target paths

    @echo off
    setlocal enableExtensions enableDelayedExpansion
    cd /D "%~dp0"
    set br=^
    
    
    rem br;
    
    
    set "pafIf=<>"
    set "gIfZsymLink="
    for /f "tokens=*" %%q in ('dir "!pafIf!" /al /b') do (
        for /f "tokens=2 delims=[]" %%r in ('dir /al ^| findstr /i /c:"%%q"') do (
            set "gIfZsymLink=!gIfZsymLink!%%~fq>%%r!br!"
        )
    )
    set "gIfZsymLink=!gIfZsymLink:~0,-1!"
    rem echo "!gIfZsymLink!"
    
    for /f "tokens=1,2 delims=>" %%q in ("!gIfZsymLink!") do (
        echo symlink: %%q , filepath: %%r
    )
    
    
    :scIn
    rem endlocal
    pause
    rem exit /b
    

提交回复
热议问题