本帖最后由 77七 于 2023-1-13 15:00 编辑
回复 16# iii888iii
- @echo off
- setlocal enabledelayedexpansion
- cd /d "D:\VMware\"
- set /a n=0
- for /f "tokens=4 delims=\." %%a in ('vmrun list ^| findstr vmx') do (
- echo %%a|findstr "[0-9]" && (
- set _"%%a"=ture
- set max1=%%a
- set /a n=n+1
- )
- ) >nul
- if %n% lss 10 ((echo 当前数字编号虚拟器开机数量:%n%) & pause & exit )
- set /a max2=max1%%5
- if %max2% equ 0 ( set /a "max3=max1-5" ) else ( set /a "max3=max1-max2" )
-
- for /l %%i in (1,5,120) do (
- set num=%%i
- set /a m=1
- set /a num1=num,num2=num+1,num3=num+2,num4=num+3,num5=num+4
- for %%b in (!num1! !num2! !num3! !num4! !num5!) do (
- if not defined _"%%b" (
- if !m! equ 1 (
- set /a m=2
- for %%c in (!num1! !num2! !num3! !num4! !num5!) do (
- if defined _"%%c" (
- if %%c leq %max3% (
- vmrun stop "D:\vos\%%c\%%c.vmx" hard
- timeout 5
- echo 关闭了虚拟机,编号%%c
- )
- )
- )
- )
- )
- )
- )
- endlocal
- pause
- exit
复制代码
1456,修改,添加了第四行。试试这样行不 |