<# .SYNOPSIS Runs the solution of a specific exercise. .DESCRIPTION This script runs the solution of a specific exercise. .PARAMETER Vorlesung The number of the lecture to run the solution. .PARAMETER Aufgabe The number of the exercise to run the solution. .EXAMPLE Run the solution of exercise 1 of lecture 12. .\Run -Vorlesung 12 -Aufgabe 1 #> param( [UInt16]$Vorlesung, [Uint16]$Aufgabe ) if ((-not (Get-Command java -ErrorAction SilentlyContinue)) -or (-not (Get-Command javac -ErrorAction SilentlyContinue))) { throw "Java is not installed. Please install Java." } $formatVorlesung = '{0:d2}' -f $Vorlesung $formatAufgabe = '{0:d2}' -f $Aufgabe Write-Host "Vorlesung $formatVorlesung / Aufgabe $formatAufgabe" $folderPathAufgabe = "VL$formatVorlesung/Aufgabe$formatAufgabe" $filePathAufgabe = "$folderPathAufgabe/Aufgabe$formatAufgabe.java" if (Test-Path $folderPathAufgabe -PathType Container) { Get-ChildItem -path $folderPathAufgabe -Filter *.java -File | ForEach-Object { &"javac" $_.FullName} } if (Test-Path $filePathAufgabe -PathType Leaf) { java $filePathAufgabe.Replace('/', '.').Replace('.java', '') }