Running commands in Windows virtual machines
To run an arbitrary command inside a Windows VM and receive the output to your console, use the virsh x-exec
command. For example:
# virsh x-exec bbf4a6ec-865f-4e2c-ac21-8639d1bfb85c --shell dir c:\\ Volume in drive C has no label. Volume Serial Number is D0BE-A8D1 Directory of c:\ 06/10/2009 01:42 PM 24 autoexec.bat 06/10/2009 01:42 PM 10 config.sys 07/13/2009 06:37 PM <DIR> PerfLogs 11/12/2018 07:45 AM <DIR> Program Files 11/12/2018 07:55 AM <DIR> test 11/12/2018 06:23 AM <DIR> Users 11/12/2018 07:53 AM <DIR> Windows 2 File(s) 34 bytes 5 Dir(s) 59,329,495,040 bytes free
To copy a file to a Windows VM, use the virsh x-exec
and prl_cat
commands. For example:
# virsh x-exec bbf4a6ec-865f-4e2c-ac21-8639d1bfb85c \ --shell '%programfiles%\\qemu-ga\\prl_cat' 'c:\test\test.file' < /home/test.file
To get a file from a Windows VM, use the virsh x-exec
and type
commands. For example:
# virsh x-exec bbf4a6ec-865f-4e2c-ac21-8639d1bfb85c \ --shell type 'c:\test\test.file' > test.file