0

I'm trying to create a script to execute a 16-bit application through NTVDM in a x86 Operating System.

This application uses network mapped drives to work, so these drives must be connected to function.

The problem comes when I try to execute this app" (executes through a bat), when I have 'compiled' the PowerShell script to an .exe file, (cant use the .ps1 because it's a WPF script that's distributed to multiple users and they mustn't access the code).

Whenever I run the app within the Powershell ISE it runs perfectly, but once I compile it to exe, it throws the same error as when there's no mapped drives.

I'm using Start-Process cmdlet, tried using -PassThru, -LoadUserProfile, -NoNewEnvironment and also tried executing CMD calling the bat (with /c and /k):

This is what I tried with cmd:

Start-Process 'cmd' -ArgumentList "/c ""C:\Soft\X\System x.bat"""
Start-Process 'cmd' -ArgumentList "/k ""C:\Soft\X\System x.bat"""

And this is what I tried with Start-Process:

Start-Process -FilePath 'C:\Soft\X\System x.bat'
Start-Process -FilePath 'C:\Soft\X\System x.bat' -PassThru
Start-Process -FilePath 'C:\Soft\X\System x.bat' -PassTrhu -LoadUserProfile
Start-Process -FilePath 'C:\Soft\X\System x.bat' -PassTrhu -NoNewEnvironment

Tried all these to no avail and I ran out of ideas. Couldn't find anything in web searches related to this.

EDIT2: Any ideas?

  • I don't expect to create any Batch file, the batch file which is already created only calls the application executable (not mine application, the 16-bit app which uses NTVDM), what I'm trying to achieve is to call this batch file from my script without it messing with the network mapped drives. As I stated in the post, opening the batch directly runs the 16bit program well, but calling it from a powershell compilated script (to exe) makes the 16bit app not recognize mapped network drives, calling the batch from ISE executes it properly too. – Franco Canciani Aug 14 '23 at 13:15

0 Answers0