Get-ChildItem -Recurse -File -Filter *.lnk `
| ForEach-Object -begin {
$ErrorActionPreference = "Stop"
$shell = New-Object -ComObject "WScript.Shell"
} -process {
try {
$shell.CreateShortcut($_.FullName)
} catch {
# スルー
}
} -End {
$ErrorActionPreference = "SilentlyContinue"
} `
| Where-Object {
-not (Test-Path $_.TargetPath)
} `
| Select-Object FullName,TargetPath
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme