Vmware虚拟机教程之vmware命令行
白羽 2018-07-25 来源 :网络 阅读 8613 评论 0

摘要:本文将带你了解Vmware虚拟机教程之vmware命令行,希望本文对大家学Vmware有所帮助。

本篇讲解几个简单的vmware的命令。





vmrun start "d:\\centos\\qs.vmx" nogui 无界面启动
vmrun start "d:\\centos\\qs.vmx" gui 图形化界面启动
vmrun list 列出正在运行的虚拟机
vmrun stop "d:\\centos\\qs.vmx" soft 正常关闭虚拟机
vmrun stop "d:\\centos\\qs.vmx" hard 强制关闭虚拟机
vmrun reset "d:\\centos\\qs.vmx" soft 热重启虚拟机
vmrun reset "d:\\centos\\qs.vmx" hard 冷重启虚拟机
vmrun sudpend "d:\\centos\\qs.vmx" soft 热挂起(休眠)
vmrun sudpend "d:\\centos\\qs.vmx" hard 冷挂起(休眠)
vmrun pause "d:\\centos\\qs.vmx" 暂停虚拟机
vmrun listsnapshots "d:\\centos\\qs.vmx" 查看某虚拟机有多少快照
vmrun snapshot "d:\\centos\\qs.vmx" snapshotcmdtest 创建快照
vmrun deleteSnapshot "d:\\centos\\qs.vmx" snapshotcmdtest 删除一个快照
vmrun revertToSnapshot "d:\\centos\\qs.vmx" snapshotcmdtest 从快照中恢复1234567891011121314








Invalid argument: --help
vmrun version 1.15.0 build-2985596

Usage: vmrun [AUTHENTICATION-FLAGS] COMMAND [PARAMETERS]



AUTHENTICATION-FLAGS
--------------------
These must appear before the command and any command parameters.

   -h <hostName>  (not needed for Workstation)
   -P <hostPort>  (not needed for Workstation)
   -T <hostType> (ws|server|server1|fusion|esx|vc|player)
     for example, use '-T server' for Server 2.0
                  use '-T server1' for Server 1.0
                  use '-T ws' for VMware Workstation
                  use '-T ws-shared' for VMware Workstation (shared mode)
                  use '-T esx' for VMware ESX
                  use '-T vc' for VMware vCenter Server
   -u <userName in host OS>  (not needed for Workstation)
   -p <password in host OS>  (not needed for Workstation)
   -vp <password for encrypted virtual machine>
   -gu <userName in guest OS>
   -gp <password in guest OS>

// 关于虚拟机电源的命令

POWER COMMANDS           PARAMETERS           DESCRIPTION
--------------           ----------           -----------
start                    Path to vmx file     Start a VM or Team (vmrun start "d:\\centos\\qs.vmx" nogui 无界面启动)
                         [gui|nogui]                             (vmrun start "d:\\centos\\qs.vmx" gui 图形化界面启动)

stop                     Path to vmx file     Stop a VM or Team (vmrun stop "d:\\centos\\qs.vmx" soft 正常关闭虚拟机)
                         [hard|soft]                            (vmrun stop "d:\\centos\\qs.vmx" hard 强制关闭虚拟机)

reset                    Path to vmx file     Reset a VM or Team (vmrun reset "d:\\centos\\qs.vmx" soft 热重启虚拟机)
                         [hard|soft]                             (vmrun reset "d:\\centos\\qs.vmx" hard 冷重启虚拟机)

suspend                  Path to vmx file     Suspend a VM or Team (vmrun sudpend "d:\\centos\\qs.vmx" soft 热挂起)
                         [hard|soft]                               (vmrun sudpend "d:\\centos\\qs.vmx" hard 冷挂起)

pause                    Path to vmx file     Pause a VM (vmrun pause "d:\\centos\\qs.vmx" 暂停虚拟机)

unpause                  Path to vmx file     Unpause a VM (vmrun unpause "d:\\centos\\qs.vmx" 从暂停中恢复虚拟机)

// 关于快照的命令

SNAPSHOT COMMANDS        PARAMETERS           DESCRIPTION
-----------------        ----------           -----------
listSnapshots            Path to vmx file     List all snapshots in a VM 
                         [showTree]           (vmrun listSnapshots "d:\\centos\\qs.vmx" 查看某虚拟机有多少快照)

snapshot                 Path to vmx file     Create a snapshot of a VM
                         Snapshot name        (vmrun snapshot "d:\\centos\\qs.vmx" snapshotcmdtest 创建一个快照)

deleteSnapshot           Path to vmx file     Remove a snapshot from a VM
                         Snapshot name        (vmrun deleteSnapshot "d:\\centos\\qs.vmx" snapshotcmdtest 删除一个快照)
                         [andDeleteChildren]

revertToSnapshot         Path to vmx file     Set VM state to a snapshot
                         Snapshot name        (vmrun revertToSnapshot "d:\\centos\\qs.vmx" snapshotcmdtest 从快照中恢复)



GUEST OS COMMANDS        PARAMETERS           DESCRIPTION
-----------------        ----------           -----------
runProgramInGuest        Path to vmx file     Run a program in Guest OS
                         [-noWait]
                         [-activeWindow]
                         [-interactive]
                         Complete-Path-To-Program
                         [Program arguments]

fileExistsInGuest        Path to vmx file     Check if a file exists in Guest OS
                         Path to file in guest

directoryExistsInGuest   Path to vmx file     Check if a directory exists in Guest OS
                         Path to directory in guest

setSharedFolderState     Path to vmx file     Modify a Host-Guest shared folder
                         Share name
                         Host path
                         writable | readonly

addSharedFolder          Path to vmx file     Add a Host-Guest shared folder
                         Share name
                         New host path

removeSharedFolder       Path to vmx file     Remove a Host-Guest shared folder
                         Share name

enableSharedFolders      Path to vmx file     Enable shared folders in Guest
                         [runtime]

disableSharedFolders     Path to vmx file     Disable shared folders in Guest
                         [runtime]

listProcessesInGuest     Path to vmx file     List running processes in Guest OS

killProcessInGuest       Path to vmx file     Kill a process in Guest OS
                         process id

runScriptInGuest         Path to vmx file     Run a script in Guest OS
                         [-noWait]
                         [-activeWindow]
                         [-interactive]
                         Interpreter path
                         Script text

deleteFileInGuest        Path to vmx file     Delete a file in Guest OS
Path in guest            

createDirectoryInGuest   Path to vmx file     Create a directory in Guest OS
Directory path in guest  

deleteDirectoryInGuest   Path to vmx file     Delete a directory in Guest OS
Directory path in guest  

CreateTempfileInGuest    Path to vmx file     Create a temporary file in Guest OS

listDirectoryInGuest     Path to vmx file     List a directory in Guest OS
                         Directory path in guest

CopyFileFromHostToGuest  Path to vmx file     Copy a file from host OS to guest OS
Path on host             Path in guest


CopyFileFromGuestToHost  Path to vmx file     Copy a file from guest OS to host OS
Path in guest            Path on host


renameFileInGuest        Path to vmx file     Rename a file in Guest OS
                         Original name
                         New name

captureScreen            Path to vmx file     Capture the screen of the VM to a local file
Path on host             

writeVariable            Path to vmx file     Write a variable in the VM state
                         [runtimeConfig|guestEnv|guestVar]
                         variable name
                         variable value

readVariable             Path to vmx file     Read a variable in the VM state
                         [runtimeConfig|guestEnv|guestVar]
                         variable name

getGuestIPAddress        Path to vmx file     Gets the IP address of the guest
                         [-wait]



GENERAL COMMANDS         PARAMETERS           DESCRIPTION
----------------         ----------           -----------
list                                          List all running VMs (vmrun list 列出所有正在运行的虚拟机)

upgradevm                Path to vmx file     Upgrade VM file format, virtual hw

installTools             Path to vmx file     Install Tools in Guest

checkToolsState          Path to vmx file     Check the current Tools state

register                 Path to vmx file     Register a VM

unregister               Path to vmx file     Unregister a VM

listRegisteredVM                              List registered VMs

deleteVM                 Path to vmx file     Delete a VM (vmrun deleteVM vmname 删除名为vmname的虚拟机) 

clone                    Path to vmx file     Create a copy of the VM (克隆一个虚拟机:完全克隆/链接克隆)
                         Path to destination vmx file
                         full|linked
                         [-snapshot=Snapshot Name]
                         [-cloneName=Name]




Examples:


Starting a virtual machine with Workstation on a Windows host
   vmrun -T ws start "c:\my VMs\myVM.vmx"


Stopping a virtual machine on an ESX host
   vmrun -T esx -h https://myHost.com/sdk -u hostUser -p hostPassword stop "[storage1] vm/myVM.vmx"


Running a program in a virtual machine with Workstation on a Windows host with Windows guest
   vmrun -T ws -gu guestUser -gp guestPassword runProgramInGuest "c:\my VMs\myVM.vmx" "c:\Program Files\myProgram.exe"


Running a program in a virtual machine with Server on a Linux host with Linux guest
   vmrun -T server -h https://myHost.com:8333/sdk -u hostUser -p hostPassword -gu guestUser -gp guestPassword runProgramInGuest "[standard] vm/myVM.vmx" /usr/bin/X11/xclock -display :0


Creating a snapshot of a virtual machine with Workstation on a Windows host
   vmrun -T ws snapshot "c:\my VMs\myVM.vmx" mySnapshot


Reverting to a snapshot with Workstation on a Windows host
   vmrun -T ws revertToSnapshot "c:\my VMs\myVM.vmx" mySnapshot


Deleting a snapshot with Workstation on a Windows host
   vmrun -T ws deleteSnapshot "c:\my VMs\myVM.vmx" mySnapshot


Enabling Shared Folders with Workstation on a Windows host
   vmrun -T ws enableSharedFolders "c:\my VMs\myVM.vmx"123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216    

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标系统运维之Vmware频道!

本文由 @白羽 发布于职坐标。未经许可,禁止转载。
喜欢 | 1 不喜欢 | 0
看完这篇文章有何感觉?已经有1人表态,100%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程