fatso83/vmware-auto-suspend

Batch file simplifications

Closed this issue · 1 comments

The following simplification is possible to SuspendRunningVMs.bat:

When creating %temp%\vmlist.txt, the pipe segment with the FIND /V can be eliminated, replacing it with a "skip=1 delims=*" in the FOR /F statement (which skips the first line, which contains the Total Running VMs: string. (#6 also uses this technique.) Should :ResumeVM be called from a FOR /F loop, the same applies.

Also, the blank line at the end of the output of vmrun list is produced by cmd.exe, not by vmrun list itself, so if this blank line is the only reason for the blank line checks in :SuspendVM and :ResumeVM, those checks can be removed.

OK, thanks! Feel free to supply a PR if you have tested the results to work :)