Is there a way to start a Command Prompt or Powershell script in the foreground? The following execution at logon always puts the script in the background, meaning there's no indication when it finished:
my-project.wsb:
<LogonCommand>
<Command>C:\Users\WDAGUtilityAccount\Desktop\my-project\init.cmd</Command>
</LogonCommand>
init.cmd:
@ECHO OFF
powershell.exe Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
powershell.exe "C:\Users\WDAGUtilityAccount\Desktop\my-project\provision.ps1"
provision.ps1:
#Requires -Version 5
Write-Host "Preinstall script started..."
New-Item -ItemType "directory" -Path "C:\Temp\GHIDRA"
Copy-Item -Path "C:\Users\WDAGUtilityAccount\Desktop\my-project\GHIDRA\*" -Destination "C:\Temp\GHIDRA\" -Recurse
Start-Process -FilePath "C:\Temp\GHIDRA\OpenJDK11U-jdk_x64_windows_hotspot_11.0.8_10.msi" -ArgumentList "/quiet /norestart"
Expand-Archive -Path "C:\Temp\GHIDRA\ghidra_9.1.2_PUBLIC_20200212.zip" -DestinationPath "C:\"
The reason why I don't use a Batch script is zip extraction...
Thank You for your help!
EDIT:
I found a solution how to keep a window open until it finishes it's task. We utilitize the `START` command with the maximized window flag:
START /MAX powershell.exe "C:\Users\WDAGUtilityAccount\Desktop\my-project\provision.ps1"