【发布时间】:2022-01-03 20:49:02
【问题描述】:
txt 文件只是一堆 UNC 路径,我试图在验证测试路径后从该文本文件中获取 UNC 路径列表,并将其放入另一个文本文件中。它会在屏幕上显示经过验证的路径,但不会填充文本文件。
$cfgs = Get-Content .\cfgpath.txt
$cfgs | % {
if (Test-Path $_) { write-host "$_" | Out-File -FilePath c:\temp\1.txt -Append }
}
【问题讨论】:
标签: powershell write-host