how to store variable in dialog scripts

Hi team, 

I am using below powershell code to select a csv file from dialogbox, now i want to store data in variable which is in csv file and afterward storing data in variable  want to excute forech loop

Function Get-FileName($initialDirectory)
{   
 [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
 Out-Null

 $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
 $OpenFileDialog.initialDirectory = $initialDirectory
 $OpenFileDialog.filter = "All files (*.*)| *.*"
 $OpenFileDialog.ShowHelp = $true
 $OpenFileDialog.ShowDialog() | Out-Null
 $OpenFileDialog.filename
} #end function Get-FileName

# *** Entry Point to Script ***

Get-FileName -initialDirectory "c:\"

March 31st, 2015 10:36am

Is this for a class or something? I just answered this for someone else.

https://social.technet.microsoft.com/Forums/scriptcenter/en-US/d9f5af08-9809-442c-84e4-ab795f0559d0/storing-variable-from-file-dialog-box?forum=ITCG

Free Windows Admin Tool Kit Click here and download it now
March 31st, 2015 10:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics