powershell遍历注册dll
# 设置要遍历的根文件夹路径,你可以根据实际情况修改这个路径
$rootFolder = "C:\script\dlls"
# 获取该文件夹及其子文件夹下所有的.dll文件
$dllFiles = Get-ChildItem -Path $rootFolder -Filter "*.dll" -Recurse
# 遍历每个找到的.dll文件并尝试注册
foreach ($dllFile in $dllFiles) {
$dllFilePath = $dllFile.FullName
Write-Host "正在注册 $dllFilePath"
try {
# 使用regsvr32命令注册DLL文件,/s参数表示静默注册(不显示提示框)
Start-Process -FilePath "regsvr32.exe" -ArgumentList "/s", $dllFilePath -Wait -NoNewWindow
Write-Host "$dllFilePath 注册成功"
}
catch {
Write-Host "$dllFilePath 注册失败,错误信息: $($_.Exception.Message)"
}
}
https://origin.softwaredownloads.sap.com/public/site/index.html