在 OS X 上,使用 VirtualBox 的命令行界面,如何指示虚拟机在 Web 浏览器中打开 URL?

发布于 2024-12-03 16:03:53 字数 113 浏览 1 评论 0原文

从 Mac OS X 的终端中,我想使用 VBoxManage guestcontrol 来控制 VirtualBox 虚拟机中的 Windows XP,以在 Internet Explorer 中打开 URL。

From Terminal in Mac OS X, I want to use VBoxManage guestcontrol to control Windows XP in a VirtualBox Virtual Machine, to open a URL in Internet Explorer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

糖粟与秋泊 2024-12-10 16:03:53

步骤

  1. 启动虚拟机:VBoxManage startvm "{VM NAME}" --type headless
  2. 打开 URL:VBoxmanage guestcontrol "{VM NAME}" exec "{SHORT PATH TO THE BROWSER}" - -用户名“{USER NAME}”--密码“{PASSWORD}”“{URL TO OPEN}”

Headless

--type headless 选项是可选的,如果您想查看发生了什么,可以忽略此选项。

获取短名称

获取浏览器短路径的简单方法是打开 cmd.exe 并运行;
cd "{NORMAL LONG PATH TO BROWSER}" 然后 command 将显示短路径名称。

参数

  • {VM NAME} == 虚拟机的区分大小写的名称。
  • {USER NAME} == 在 VM 上运行的来宾上的系统用户名,而不是显示的名称。
  • {PASSWORD} == 上述帐户的密码
  • {TO OPEN} == 例如:https://stackoverflow.com/
  • {SHORT PATH TO THE BROWSER} == 例如:C:\DOCUME~1\JAMIE~1\LOCALS~1\APPLIC~1\GOOGLE\CHROME\APPLIC~1\chrome.exe

示例

从可用的 VM 打开 IE9 https://github.com/xdissent/ievms

VBoxmanage guestcontrol 'IE9 - Win7' exec 'C:\Progra~1\Intern~1\iexplore.exe' --username 'IEUser' --password 'Passw0rd!' 'http://google.com'

感谢

http://www.quora.com/Chapley-Watson 为了这个答案,我搜索了所有地方,包括 Stack溢出并没有得到回复。希望这会对某人有所帮助。

Steps

  1. Start the VM: VBoxManage startvm "{VM NAME}" --type headless
  2. Open the URL: VBoxmanage guestcontrol "{VM NAME}" exec "{SHORT PATH TO THE BROWSER}" --username "{USER NAME}" --password "{PASSWORD}" "{URL TO OPEN}".

Headless

The --type headless option is optional, if you want to see what's happening you can omit this.

Getting the short name

An easy way to get the short path to the browser is to open cmd.exe and run;
cd "{NORMAL LONG PATH TO BROWSER}" then command and the short path name will be displayed.

Params

  • {VM NAME} == Case sensitive name of the virtual machine.
  • {USER NAME} == System User name on the guest running on the VM, not the displayed name.
  • {PASSWORD} == Password for the above account
  • {URL TO OPEN} == eg: https://stackoverflow.com/
  • {SHORT PATH TO THE BROWSER} == eg: C:\DOCUME~1\JAMIE~1\LOCALS~1\APPLIC~1\GOOGLE\CHROME\APPLIC~1\chrome.exe

Example

To open IE9 from the VM available from https://github.com/xdissent/ievms

VBoxmanage guestcontrol 'IE9 - Win7' exec 'C:\Progra~1\Intern~1\iexplore.exe' --username 'IEUser' --password 'Passw0rd!' 'http://google.com'

Credit

Thanks to http://www.quora.com/Chapley-Watson for this answer, I'd searched all over the place including Stack Overflow and got no replies. Hopefully this will help someone.

遗弃M 2024-12-10 16:03:53

正在完成 VBox 5.0.2 新版本的 Fold_left 答案

在新版本中,他们更改了一些命令。该过程如下:

步骤:

  1. 启动 VM:VBoxManage startvm "{VM NAME}" --type headless(无更改)
  2. 打开 URL:VBoxmanage guestcontrol "{VM NAME} " start --exe "{浏览器的短路径}" --用户名 "{用户名}" --密码 "{PASSWORD}" -- iexplore "{要打开的 URL}"。 (新命令

示例

https://github.com 上提供的 VM 打开 IE9 /xdissent/ievms

VBoxmanage guestcontrol 'IE9 - Win7' start --exe 'C:\Progra~1\Intern~1\iexplore.exe' --username 'IEUser' --密码'Passw0rd!' -- iexplore 'http://www.wikipedia.org'

Completing fold_left answer for new version of VBox 5.0.2

With new version they have changed some commands. The process will be as follows:

Steps:

  1. Start the VM: VBoxManage startvm "{VM NAME}" --type headless (no changes)
  2. Open the URL: VBoxmanage guestcontrol "{VM NAME}" start --exe "{SHORT PATH TO THE BROWSER}" --username "{USER NAME}" --password "{PASSWORD}" -- iexplore "{URL TO OPEN}". (new commands)

Example

To open IE9 from the VM available from https://github.com/xdissent/ievms

VBoxmanage guestcontrol 'IE9 - Win7' start --exe 'C:\Progra~1\Intern~1\iexplore.exe' --username 'IEUser' --password 'Passw0rd!' -- iexplore 'http://www.wikipedia.org'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文