Thursday, April 20, 2023

command to check vmrun. if not start it

 "C:\Program Files (x86)\VMware\VMware Player\vmrun.exe" list>run.txt

find  "Test.vmx" run.txt >nul

if %errorlevel%==0 (echo active is true) else (("C:\Program Files (x86)\VMware\VMware Player\vmrun.exe" -T player start "c:\VirtualBox VMs\vmware\test\Test.vmx" nogui) & (echo Logged time = %time% %date%>> d:\log.txt))

::pause

del run.txt

timeout /t 120




meaning

program1 & program2    --> run program1 until finish and run program2

program1 && program2 --> run program1 and program2 together

::  ---> comment on dos

if (ifcondition) (true command) else ( false command)


find  "Test.vmx" run.txt >nul

errorlevel

0 found

1 notfound

2 ???