Find out whether a file is a symbolic link in PowerShell
问题 I am having a PowerShell script which is walking a directory tree, and sometimes I have auxiliary files hardlinked there which should not be processed. Is there an easy way of finding out whether a file (that is, System.IO.FileInfo ) is a hard link or not? If not, would it be easier with symbolic links (symlinks)? 回答1: Try this: function Test-ReparsePoint([string]$path) { $file = Get-Item $path -Force -ea SilentlyContinue return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)