I trying to get out this code to a variable. I get the pop-up screen, but don't see how to get it to a variable.
Import-Csv "d:\files\divcode.csv" |
select-object -property * |
out-gridview -OutputMode Single -Title 'Select a row' |
ForEach-Object {
$DevCode = $_DivisionCode
}
Write-host "$DevCode"
The input is:
"DivisionCode","Division Name"
"MY","MY - Northeast Concord"
"SO","SO - Southern"
"PA","PA - Pennsylvania"
I would like to select like MY row and get the output to be just the first colurm.
Out-gridview to a single variable.
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- cgjackson@yahoo.com
- Posts: 7
- Last visit: Tue Aug 07, 2018 5:16 am
Re: Out-gridview to a single variable.
[TOPIC MOVED TO POWERSHELL FORUM BY MODERATOR]
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Out-gridview to a single variable.
Like this:
- Import-Csv d:\files\divcode.csv |
- out-gridview -OutputMode Single -Title 'Select a row' |
- Select-Object -expand DivisionCode