Run EXE from Powershell but run rest of script when EXE quits. Possible?

I’m trying to do a silly thing really. I’m wanting to run the old Blade Runner graphical adventure game under Windows 10. But it only runs the BLADE.EXE properly if the Blade-Runner-CD1.iso is mounted, else it shits the bed and quits. Since I don’t want to manually mount and unmount the iso CD image file manually each time I want to run the game, I’m trying to script it. I’m new to Windows so here is what I have at the moment.

A batch file called Blade-Runner.bat which runs:

C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -ExecutionPolicy unrestricted -File Blade-Runner.ps1

The PowerShell script Blade-Runner.ps1 and looks like: –

Mount-DiskImage -ImagePath ‘D:GamesBlade RunnerBlade-Runner-CD-1.iso’

& ‘D:GamesBlade RunnerBLADE.EXE’

Dismount-DiskImage -ImagePath ‘D:GamesBlade RunnerBlade-Runner-CD-1.iso’

Problem is, PowerShell runs the BLADE.EXE and also then immediately runs the Dismount-DiskImage command right after, so the game load fails as the iso has already been dismounted. Is there any way to have the executable run in some sort of blocking mode so that the rest of the script only happens once the EXE is finished? Is what I’m trying to do even possible?

EDIT: Sorted as below – thanks Reddit! One other thing, is there a way to cut out the batch file part and just be able to double-click on the PowerShell script to do this? Having a batch file to call a PS script seems kinda rubbish.

submitted by /u/arashi256
[link] [comments]

Leave a Reply