借用多年前一个来自于WAMP产品的脚本改装成启动关闭VM中的hadoop主机N.bat,参考均来自于网络!
@ECHO OFF SETLOCAL TITLE VMware管理 echo VMware管理 REM 管理服务 @for /f "delims=," %%i in ( '1','2','4') do echo "%%i" :_VMWARE_SELECT_ :{ cls echo ================================================================= echo ========================VMWARE后台启动======================= echo ================================================================= cd cd C:Program Files (x86)VMwareVMware Workstation echo 1、帮助 echo 2、启动hadoop集群 echo 3、重启hadoop集群 echo 4、停止hadoop集群 echo 5、挂起hadoop集群 echo 6、查看activeVMware echo 0、退出 echo. SET SELECT=9 SET /P SELECT=请选择您要进行的操作(默认:1) IF "%SELECT%" == "0" goto _VMWARE_SELECT_END_ IF "%SELECT%" == "1" vmrun --help && pause && sleep 5 && goto END IF "%SELECT%" == "2" @set op=start IF "%SELECT%" == "3" @set op=reset IF "%SELECT%" == "4" @set op=stop IF "%SELECT%" == "5" @set op=suspend IF "%SELECT%" == "5" vmrun list && pause && @goto END vmrun %op% "C:softVMHadoop01Hadoop01.vmx" nogui vmrun %op% "C:softVMHadoop02Hadoop02.vmx" nogui vmrun %op% "C:softVMHadoop03Hadoop03.vmx" nogui goto _VMWARE_SELECT_ :} :_VMWARE_SELECT_END_ :{ @goto END :} :END :{ ENDLOCAL exit 0 goto :EOF :}