1
我想知道爲什麼當我運行我的腳本結果顯示我「;」在我的陣列之間。實際上我試圖比較兩個excel列並顯示差異。如果單元格不在第一列中,而是在第二列中顯示該列。我怎樣才能刪除這些「;」並獲得列之間的區別?我也試着與一列一些文件,它的工作原理PowerShell腳本:結果問題
結果:
ComputerName;;;;;OtherComputerName
----------------------------------
uiojk;;;;;uih
hjbyu;;;;;ubyhi`
腳本:
#get the content of the column in the file
[string[]]$a = import-csv '.\test1.csv' | select -expand ComputerName
[string[]]$d = import-csv '.\test1.csv' | select -expand OtherComputerName
#display the cells which aren't in the $a list
$d |? {$a -notcontains $_}
#displays the columns of one file
[Array]$stores[2].ComputerName
[Array]$stores[2].OtherComputerName
$stores