是否有一种简单的方法可以在 PowerShell(我想使用 gacutil.exe)中从文本文档中读取路径\程序集并将其注册到 GAC 中?例如,一个 .txt 文件看起来像:
c:\test\myfile.dll
c:\myfile2.dll
d:\gac\gacthisfile.dll
PowerShell 脚本会将其读入流中,然后在找到的每个程序集上运行 gacutil?我想它会是这样的:
#read files into array?
foreach ($file in Get-ChildItem -Filter "*.dll" )
{
Write-Host $file.Name
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil.exe /nologo /i $file.Name
}