VM_object.start_process('cmd.exe', args=["shutdown /r"])
in virtual machine this command will be interpreted as
cmd.exe "shutdown /r"
because start_process use subprocess.list2cmdline() method to parse "args" parameter. list2cmdline() adds quotes for any list's element that contain spaces.
So, next, about cmd parameters. Use
cmd /?
to understand what you should use in your code. There is 2 intresting args for me in my tasks:
- cmd.exe /c ... , to just close cmd window after execution
- cmd.exe /k ... , to not close console window after execution commands
/k usefull, for example, when your python code intrested in asking last %errorlevel% of batch-file, executed by popen.
So, i think, your code should looks like:
VM_object.start_process('cmd.exe', args=["/c","shutdown", "/r"])