How would i link a buttton to open a batch file in windows forms using powershell, i have the following code below just need the add click event
$run = New-Object System.Windows.Forms.Button
$run.Location = New-Object System.Drawing.Size(95,450)
$run.Size = New-Object System.Drawing.Size(75,23)
$run.Text = "Run"
$run.Add_Click({ })
$objForm.Controls.Add($run)
By open, do you mean execute the script or edit it in a word processor?
You can treat the brackets within the Add_Click event like any ‘ole [ScriptBlock].
To execute the batch file:
Or, open it in notepad:
Or call some other function..