I'm making a program to change various icons through RegEdit, and I figured a nice GUI where people can choose which .ico files they would like their file changed to would be a good touch. Only thing is, I know nothing about PowerShell, but it was much easier to manipulate RegEdit than with Python. And I know less so about PowerShell GUI.
Add-Type -AssemblyName System.Windows.Forms
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = [Environment]::GetFolderPath('Desktop')
Filter = 'Icons (*.ico)|*.ico'
}
$result = $FileBrowser.ShowDialog()
<#What do here?#>
The last line, where the comment is, what do I do to get the string, or whatever datatype, that contains the file name I just searched for? For anyone curious, that $FileBrowser
just gives a default Windows file search window, which I just placed a .ico
restriction on. What method do I call? I read something about DialogResult
but I don't understand how that method or applet ties in to ShowDialog
nor how it is used to obtain the filename, (if that is the right solution)