未知的子命令:使用guestcontrol选项时'执行'

Abd*_*UMI 4 virtualbox command-line-interface

我正在尝试运行/bin/lsVirtualBox提供的命令行界面vboxmanage guestcontrol.

按照此文档,我运行这些命令:

vboxmanage startvm centos6;
vboxmanage  guestcontrol "centos6" execute --image "/bin/ls" --username root --passwordfile pwd.txt --wait-exit --wait-stdout -- -l /usr;
Run Code Online (Sandbox Code Playgroud)

我有以下内容stdout:

Oracle VM VirtualBox命令行管理界面版本5.0.0(C)2005-2015 Oracle Corporation保留所有权利.

用法:

VBoxManage guestcontrol [--verbose | -v] [--quiet | -q] [--username] [--domain] [ - passwordfile | - 密码]

                          run [common-options]
                          [--exe <path to executable>] [--timeout <msec>]
                          [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]
                          [--ignore-operhaned-processes] [--no-profile]
                          [--no-wait-stdout|--wait-stdout]
                          [--no-wait-stderr|--wait-stderr]
                          [--dos2unix] [--unix2dos]
                          -- <program/arg0> [argument1] ... [argumentN]]

                          start [common-options]
                          [--exe <path to executable>] [--timeout <msec>]
                          [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]
                          [--ignore-operhaned-processes] [--no-profile]
                          -- <program/arg0> [argument1] ... [argumentN]]

                          copyfrom [common-options]
                          [--dryrun] [--follow] [-R|--recursive]
                          <guest-src0> [guest-src1 [...]] <host-dst>

                          copyfrom [common-options]
                          [--dryrun] [--follow] [-R|--recursive]
                          [--target-directory <host-dst-dir>]
                          <guest-src0> [guest-src1 [...]]

                          copyto [common-options]
                          [--dryrun] [--follow] [-R|--recursive]
                          <host-src0> [host-src1 [...]] <guest-dst>

                          copyto [common-options]
                          [--dryrun] [--follow] [-R|--recursive]
                          [--target-directory <guest-dst>]
                          <host-src0> [host-src1 [...]]

                          mkdir|createdir[ectory] [common-options]
                          [--parents] [--mode <mode>]
                          <guest directory> [...]

                          rmdir|removedir[ectory] [common-options]
                          [-R|--recursive]
                          <guest directory> [...]

                          removefile|rm [common-options] [-f|--force]
                          <guest file> [...]

                          mv|move|ren[ame] [common-options]
                          <source> [source1 [...]] <dest>

                          mktemp|createtemp[orary] [common-options]
                          [--secure] [--mode <mode>] [--tmpdir <directory>]
                          <template>

                          stat [common-options]
                          <file> [...]
Run Code Online (Sandbox Code Playgroud)

VBoxManage guestcontrol [--verbose | -v] [--quiet | -q]

                          list <all|sessions|processes|files> [common-opts]

                          closeprocess [common-options]
                          <   --session-id <ID>
                            | --session-name <name or pattern>
                          <PID1> [PID1 [...]]

                          closesession [common-options]
                          <  --all | --session-id <ID>
                            | --session-name <name or pattern> >

                          updatega|updateguestadditions|updateadditions
                          [--source <guest additions .ISO>]
                          [--wait-start] [common-options]
                          [-- [<argument1>] ... [<argumentN>]]

                          watch [common-options]
Run Code Online (Sandbox Code Playgroud)

语法错误:未知的子命令:'execute'

rev*_*her 7

是的,执行似乎不再适用于最新的5.0.10版本的VirtualBox.尝试使用'run'而不是'execute'和'--exe'而不是'--image'.

另外--wait-exit已被禁止.

这是我现在使用的命令: $ VBoxManage --nologo guestcontrol "Windows7-64" run --exe "C:\Windows\SysWOW64\cmd.exe" foo.bat --username myname --verbose --wait-stdout --wait-stderr -- "/c" "f:\path\foo.bat" "arg1" "f:" "arg3"

该命令在OS/X上执行,以便在Windows 64bit上执行带有三个参数的批处理文件foo.bat.第二个参数'f:'是windows frive,它对应于我的程序所在的OS/X目录.在我的例子中,这个批处理文件使用windows'cmake',以便在Windows 64上编译C程序.它是交叉编译的替代方案,有时候更好,因为您可以使用具有更高性能的本机编译器,并且可以在其真实环境中测试可执行文件.

但是,'run --- exe'在某种程度上与以前的'execute --image'有所不同,因为如果命令在终端shell中运行良好,我在使用'compile'命令的emacs下会遇到困难,可能是因为--wait-exit doesn不再存在了.难的是VirtualBox VM运行时CPU消耗很高而且不会停止.但是从bash来看,它看起来和以前一样.

VBoxManage的当前文档抑制了'execute'和'--image',但使用过时(并且没有更多工作)选项的旧例子仍然存在,不幸的是增加了混淆.

更新:在VirtualBox 5上(我的是5.2.6),我正在做 $ VBoxManage --nologo guestcontrol "Windows7-64" run --exe "C:\\Windows\\system32\\cmd.exe" foo.bat --username myname --verbose --wait-stdout --wait-stderr -- "C:\Windows\SysWOW64\cmd.exe" "/c" "f:\path\foo.bat" "arg1" "f:" "arg3"

直接启动64位cmd.exe不再起作用.