我已經導入了一個.csv文件,並且在表單中的組合框中列出了第一列。我試圖將組合框中選定的數據與相應的行進行匹配。例PowerShell中的CSV問題
辦公室,服務器 芝加哥,chicago1 紐約,newyork1 洛杉磯,LA1
當他們選擇$辦公室,ID喜歡創造的下一個對象$服務器,並引用它在其他地方。
$Offices = @(Import-CSV "C:\source\PrinterTable.csv")
$Array = $Offices.office | Sort-Object
ForEach ($Choice in $Array) {
[void] $objListBox.Items.Add($Choice)
}
$handler_Office_Click=
{
$officeSelected = $objListBox.SelectedItem
$row = $officeSelected | where { $_.office -eq $officeSelected }
$server = $row.server
explorer.exe \\$server
}
我一直在Google上搜尋幾個小時...請幫助!
爲了得到這個在組合框和作爲選擇項$顯示office = $ objlistbox.selecteditem必須轉到$ handle_office_click函數。現在即時嘗試同樣的事情,但告訴它調用$服務器...仍然需要幫助。 –