くんすとの備忘録

IT系技術メモ

移転しました。

15秒後に自動的にリダイレクトします。

VMWare Playerをコマンド操作でバックグラウンド起動する

環境

VIXのインストール

VMWare Playerのダウンロードページから、VIXをダウンロード。
https://my.vmware.com/jp/web/vmware/free#desktop_end_user_computing/vmware_player/7_0|PLAYER-710|drivers_tools
※使用しているVMWare Playerに合ったバージョンのものをダウンロードすること。

起動BATの作成

定数用

[vmconst.bat]

REM VIXのexeのディレクトリを指定する(デフォルトならこのまま)
set DIR_VMRUN=C:\Program Files (x86)\VMware\VMware VIX
set CMD_VMRUN="%DIR_VMRUN%\vmrun.exe"

REM 起動したいVMのvmxファイルを絶対パスで指定する
set VMX_TARGET="D:\VMachine\FreeBSD\FreeBSD.vmx"

サービス起動

[vmstart.bat]

@echo off

call vmconst.bat
%CMD_VMRUN% -T player start %VMX_TARGET% nogui

起動中のVM一覧

[vmlist.bat]

@echo off

call vmconst.bat
%CMD_VMRUN% -T player list %VMX_TARGET%

サスペンド

[vmsuspend.bat]

@echo off

call vmconst.bat
%CMD_VMRUN% -T player suspend %VMX_TARGET%

強制終了

[vmstop.bat]

@echo off

call vmconst.bat
%CMD_VMRUN% -T player stop %VMX_TARGET%


スタートアップに「vmwtart.bat」を入れよう!