PowerShell
$excel = New-Object -comObject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
foreach ($file in Get-ChildItem -recurse -force -Path "C:\SGPRL\*.xls?") {
Write-Output "Explorant $($file.FullName) ..." >> C:\SGPRL\enllacos.txt
$workbook = $excel.Workbooks.Open($file.FullName)
foreach ($sheet in $workbook.Sheets) {
foreach ($cell in $sheet.Hyperlinks) {
# $cell.Address = $cell.Address -ireplace $oldname, $newname
if ($cell.Address.Contains("128.128")
|| $cell.Address.Contains("estacio68")
|| $cell.Address.Contains("ESTACIO68"))
{
Write-Output "ENLLAÇ -> $($sheet.Name) $($cell.Address)" >> C:\SGPRL\enllacos.txt
}
}
}
# $workbook.Save()
$workbook.Close()
}
$excel.quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($workbook)
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excel)
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()