macoszshparallels

Problems with prlctl exec in zsh using Parallels, permission denied: NUL


In this stack overflow answer there is a solution that almost works for me.

I have a Windows virtual machine running on top of Parallels on a Mac.

I want to write a python scripts that run on the Mac's OS-X UNIX-like environment, which invoke a Windows app on Parallels. I'm trying to make sure the code executes from terminal before putting it in python.


The only problem is after executing

prlctl exec myProgram.exe argument1>NUL </dev/null & MyFileThatIRun.txt

I get the following error: zsh: permission denied: NUL

I've tried nul, NUL, I've tried running with out the NUL.

I'm not really 100% understanding the nul I just know its gotten me further.

Does anyone have insight on how to fix zsh: permission denied: NUL?

I tried a verity of permutations of the command line:

prlctl exec myProgram.exe --guest-os-type windows argument1> NUL </dev/null & MyFile
prlctl exec myProgram.exe --guest-os-type windows argument1> NUL </dev/null MyFile
prlctl exec myProgram.exe argument1> NUL </dev/null & MyFile
prlctl exec myProgram.exe argument1> NUL </dev/null MyFile 
prlctl exec myProgram.exe argument1> NUL < /dev/null & MyFile 
prlctl exec myProgram.exe argument1> NUL < /dev/null MyFile 
prlctl exec myProgram.exe argument1> NUL & MyFile 
prlctl exec myProgram.exe argument1 >NUL & MyFile

I was expecting the myProgram to launch and run the MyFile.


Solution

  • From documentations: Parallels pdf doc or parallels html doc

    prlctl exec <vm_id | vm_name> <command>
    

    So my above command was missing the vm name. I think the default case looks like the following

    prlctl exec "Windows 11" "C:\path\to\myProgram.exe" "X:path\to\MyFile.txt"
    

    However this was not quite working as expected because the program could not find myFile.txt. The problem is the user was not me so to correct that issue I use the following command

    prlctl exec --current-user "Windows 11" "C:\path\to\myProgram.exe" "X:path\to\MyFile.txt"
    

    Alterntivlty you can use

    prlctl exec --user <user_name> --password <password> "Windows 11" "C:\path\to\myProgram.exe"
    

    in order to discover all this I use the intercavie command that allows me to dynamically interact with cmd prompt via terminal.

    prlctl enter "Windows 11"
    whoami
    

    nt authority\system

    This was not the user I expected and realized I did not have access to the mounted drives I expected with that system. I discovered this by doing the following while tunneled/login to the parallels VM cmd prompt

    wmic logicaldisk get caption
    

    After correcting the vm name and the user name the command executes mostly correctly. I still have permissions issues but the program can find the myfile.txt now. I believe my current permissions issues have nothing to do with the above.