Pregunta

I am converting a program from Batch to Python. Here is how I think I could do translate the Batch

%VBM% sharedfolder add %VMNAME% --name "LogDir" --hostpath %LogDir%

into:

os.execlp(VBM, 'sharedfolder', 'add', VMNAME, '--name', "LogDir",'--hostpath', LogDir)

My questions:

  1. Considering VBM, VMNAME, and LogDir are variables that are declared beforehand within my script, is my translation correct?
  2. Is it ok that I represent the Path string with a variable, e.g. VBM
  3. What could be a better way of doing any of the above?
¿Fue útil?

Solución

I decided to go ahead and use subprocess.call() and it works.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top