我正在尝试记录powershell脚本的输出,以便删除失败的图像位置。我的脚本(import.ps1)基本上会查找包含目标和源位置的csv文件并执行复制。到目前为止,我得到一个空白的日志文件。
这就是我的尝试:
$(Import-Csv -Path E:\fileslist3.csv -ErrorAction Stop | foreach {
if (-not (Test-Path -Path $_.Destination))
{
# Create directory if needed
mkdir -Path $_.Destination -WhatIf
}
# Copy file
Copy-Item -Path $_.Source -Destination $_.Destination
}
)*>&1 > c:\log.txt
谢谢