How can I assign a link to each button? I can't manged it... I dont speak english well. Sorry for the translation...
$ButtonName =@('Option One', 'Option Two', 'Option Three') $i = 0 $ButtonName | foreach{ $CurrentButton = $null $CurrentButton = New-Object System.Windows.Forms.Button $CurrentButton.Location = "$(10+70*$i),35" $CurrentButton.width = 60 $CurrentButton.height = 60 $CurrentButton.Image = [System.Drawing.Image]::FromFile("c:\script\" + $ButtonName[$i] + ".jpg") $CurrentButton.Add_Click({Start-Process -FilePath "c:\script\" + $ButtonName[$i] + ".lnk"}) $i++ $Script.Controls.Add($CurrentButton) } $CurrentButton.Add_Click({Start-Process -FilePath "c:\script" + $ButtonName[$i] + ".lnk"}) does not work...
$PSItremor$_):"c:\script\$_.ps1"