문제

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?
도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top