PortValhalla/scripts/Windows/Scripts/BashScript.ps1

17 lines
588 B
PowerShell
Raw Normal View History

function Start-BashScript() {
param(
[Parameter(Mandatory=$true, Position=0)]
[string[]]$Content
)
Write-Information "Preparing setup script";
2024-04-01 15:02:49 +00:00
$bashLocation = Join-Path (Split-Path -Parent (Split-Path -Parent (Get-Command git-gui).Source)) "git-bash";
$script = New-TemporaryFile;
$script = Rename-Item $script -NewName "$script.sh" -PassThru;
Set-Content $script ([string]::Join("`n", $Content));
Write-Information "Running prepared script";
2024-04-01 15:02:49 +00:00
Start-Process -Wait "$bashLocation" -ArgumentList @("$script");
Remove-Item $script;
}