Skip to content

Instantly share code, notes, and snippets.

@koloved
Last active March 23, 2026 21:24
Show Gist options
  • Select an option

  • Save koloved/789ea920f8a1605a3b69f4dca4fd42c6 to your computer and use it in GitHub Desktop.

Select an option

Save koloved/789ea920f8a1605a3b69f4dca4fd42c6 to your computer and use it in GitHub Desktop.
auto close AJAZZ AK820 app (disable background)
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
Set-Location $scriptPath
$exe = Get-ChildItem -Path $scriptPath -Filter "*.exe" | Where-Object { $_.Name -notmatch "AudioRecord" } | Select-Object -First 1
if (-not $exe) {
Write-Host "Main EXE not found!" -ForegroundColor Red
exit
}
$process = Start-Process -FilePath $exe.FullName -PassThru
$id = $process.Id
Start-Sleep -Seconds 8
while ($true) {
$currentProc = Get-Process -Id $id -ErrorAction SilentlyContinue
if (-not $currentProc -or $currentProc.MainWindowHandle -eq 0) {
if ($currentProc) {
Stop-Process -Id $id -Force -ErrorAction SilentlyContinue
}
Start-Sleep -Seconds 1
$backgroundProc = Get-Process -Name "AudioRecord" -ErrorAction SilentlyContinue
if ($backgroundProc) {
Stop-Process -Name "AudioRecord" -Force -ErrorAction SilentlyContinue
}
break
}
Start-Sleep -Seconds 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment