這是我到目前為止所擁有的。我覺得我需要某種 for each statement 或某些東西來將每個源行復制到從 csv 匯入的每個目標行。想法?
$source = Import-Csv -header 'Source' C:\Test\source.csv
$destination = Import-Csv -header 'Dest' C:\Test\dest.csv
Copy-Item -Path $source -Destination $destination
uj5u.com熱心網友回復:
要回答所問的問題:檔案:Source.csv
SourceFile
G:\Test\Excel\JPLTest-1.xlsx
G:\Test\Excel\JPLTest-A.xlsx
檔案:Dest.csv
DestFile
G:\Test\Excel\JPLTest-2.xlsx
G:\Test\Excel\JPLTest-B.xlsx
代碼:
$Source = Import-CSV -Path G:\BEKDocs\Scripts\Source.csv
$Dest = Import-CSV -Path G:\BEKDocs\Scripts\Dest.csv
#Note: If you use Santiago's suggestion you don't need this test!
If (($Source.Count) -ne ($Dest.Count)) {
"CSV File line counts do not match!"
} #End If
Else {
For ($Cntr = 0 ; $Cntr -lt $($Source.count) ; $Cntr ) {
Copy-Item -Path $($Source.SourceFile[$($Cntr)]) -Destination $($Dest.DestFile[$($Cntr)])
} #End For...
} #End Else
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/476840.html
標籤:电源外壳
上一篇:如何將用戶ID添加到按鈕互動中?
