Skip to content

Instantly share code, notes, and snippets.

@Himura2la
Last active July 10, 2026 08:58
Show Gist options
  • Select an option

  • Save Himura2la/86afd5a9c6cc60dfeba79d434f03d84f to your computer and use it in GitHub Desktop.

Select an option

Save Himura2la/86afd5a9c6cc60dfeba79d434f03d84f to your computer and use it in GitHub Desktop.
Windows Forms via PowerShell
$scriptContent = @'
Add-Type -AssemblyName System.Windows.Forms
$form = New-Object System.Windows.Forms.Form
$form.Text = "PlaceholderWindow"
[System.Windows.Forms.Application]::Run($form)
'@
if (-not (Get-Module -ListAvailable -Name ps2exe)) {
Write-Host "Install ps2exe module:`n`tInstall-Module -Name ps2exe -Scope CurrentUser -Force"
} else {
$tempScriptPath = "$env:TEMP\PlaceholderWindow_Temp.ps1"
$executablePath = "$PSScriptRoot\PlaceholderWindow.exe"
Set-Content -Path $tempScriptPath -Value $scriptContent
Invoke-ps2exe -InputFile $tempScriptPath -OutputFile $executablePath -noConsole
Remove-Item -Path $tempScriptPath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment