I have a Problem with my script, and I can't find the solution. Allways when I try to run this script it says:
Cmdlet Start-Process an der Befehlspipelineposition 1 Geben Sie Werte für die folgenden Parameter an: FilePath:
What does this mean? I know I'm not very good in Powershell, just began to script in last summer. So it may look a bit ugly...
here's my script, hope someone could help me:
function Task_S{
#starting 'task_s.ps1'
$thisScriptDirectoryPath = Split-Path -parent
$MyInvocation.MyCommand.Definition
$utilityScriptName = "..\Start_and_furthers\task_s.ps1"
$utilityScript = (Join-Path $thisScriptDirectoryPath $utilityScriptName)
$result = .$utilityScript
}
function Task_D{
#starting 'task_d.ps1
$thisScriptDirectoryPath = Split-Path -parent
$MyInvocation.MyCommand.Definition
$utilityScriptName = "task_d.ps1"
$utilityScript = (Join-Path $thisScriptDirectoryPath $utilityScriptName)
$result = . $utilityScript
}
function Task_I{
#starting 'task_i.ps1
$thisScriptDirectoryPath = Split-Path -parent
$MyInvocation.MyCommand.Definition
$utilityScriptName = "task_i.ps1"
$utilityScript = (Join-Path $thisScriptDirectoryPath $utilityScriptName)
$result = . $utilityScript
}
function Task_T{
#starting 'task_t.ps1
$thisScriptDirectoryPath = Split-Path -parent
$MyInvocation.MyCommand.Definition
$utilityScriptName = "task_t.ps1"
$utilityScript = (Join-Path $thisScriptDirectoryPath $utilityScriptName)
$result = . $utilityScript
}
function Choicebuttons{
function Window {
# Add Window
$Form = New-Object System.Windows.Forms.Form
$Form.Text = "Exercises"
$Form.Size = New-Object System.Drawing.Size(200,200)
$Form.Topmost = $True
}
function Buttons {
# Add Button for S
$Button_S = New-Object System.Windows.Forms.Button
$Button_S.Location = New-Object System.Drawing.Size(40,30)
$Button_S.Size = New-Object System.Drawing.Size(120,30)
$Button_S.Text = "S: "
# Add Button for D
$Button_D = New-Object System.Windows.Forms.Button
$Button_D.Location = New-Object System.Drawing.Size(40,100)
$Button_D.Size = New-Object System.Drawing.Size(120,30)
$Button_D.Text = "D:"
# Add Button for I
$Button_I = New-Object System.Windows.Forms.Button
$Button_I.Location = New-Object System.Drawing.Size(40,100)
$Button_I.Size = New-Object System.Drawing.Size(120,30)
$Button_I.Text = "I:"
# Add Button for T
$Button_T = New-Object System.Windows.Forms.Button
$Button_T.Location = New-Object System.Drawing.Size(40,100)
$Button_T.Size = New-Object System.Drawing.Size(120,30)
$Button_T.Text = "T:"
}
function Labels {
# Add Label for S
$Label_S = New-Object System.Windows.Forms.Label
$Label_S.Location = New-Object System.Drawing.Size(40,30)
$Label_S.Text = "Strukturen suchen und dokumentieren mit Struktogramm"
# Add Label for D
$Label_D = New-Object System.Windows.Forms.Label
$Label_D.Location = New-Object System.Drawing.Size(40,30)
$Label_D.Text = "Datentypen anwenden und dokumentieren"
# Add Label for I
$Label_I = New-Object System.Windows.Forms.Label
$Label_I.Location = New-Object System.Drawing.Size(40,30)
$Label_I.Text = "Ablaufstruktur umsetzen & Quellcode ausarbeiten"
# Add Label for T
$Label_T = New-Object System.Windows.Forms.Label
$Label_T.Location = New-Object System.Drawing.Size(40,30)
$Label_T.Text = "Debuggen & Testen"
}
function AddForms {
# Add Buttons and Labels to Window
$Form.Controls.Add($Button_S)
$Form.Controls.Add($Button_D)
$Form.Controls.Add($Button_I)
$Form.Controls.Add($Button_T)
$Form.Controls.Add($Label_S)
$Form.Controls.Add($Label_D)
$Form.Controls.Add($Label_I)
$Form.Controls.Add($Label_T)
}
function ButtonEvent {
#Add Button event
$Button_S.Add_Click({Task_D})
$Button_D.Add_Click({Task_D})
$Button_I.Add_Click({Task_I})
$Button_T.Add_Click({Task_T})
}
# Starting for Window
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
# Loading Functions & Inserts
Window
Buttons
Labels
Addforms
Buttonevent
#Show the Form
$form.ShowDialog()| Out-Null
}
Choicebuttons