如何运行“Oracle VirtualBox (VBOX)"像在完全后台“Microsoft Windows (WIN)"中启动后的服务? [英] How to run "Oracle VirtualBox (VBOX)" like a service after boot in fully background "Microsoft Windows (WIN)"?
问题描述
我想运行自动启动虚拟机 (VM)"没有Oracle VirtualBox (VBOX)"图形用户界面 (GUI)"在带有Microsoft Windows (WIN)"的本地 DEV 机器上.
I want to run autostart "Virtual Machine (VM)" without "Oracle VirtualBox (VBOX)" "Graphical User Interface (GUI)" on local DEV machine with "Microsoft Windows (WIN)".
如何在完全运行的后台进程中做到这一点?
How can I do that in fully running background process?
推荐答案
解决方案
诀窍是在没有 GUI 的情况下运行 VM.有了这个,您也可以像服务一样轻松地在 WIN 服务器上运行 VM.
The trick is to run the VM without GUI. With this you can easily run VM on WIN server like a service too.
0) 先决条件是存在一些 VM,你已经有了一些.下面将其名称改为 {vm_name}.
0) Prerequired is that exist some VM, you have some already. Below put its name instead {vm_name}.
1) 首先我们使用内置的可执行文件VBoxHeadless.exe".
1) At first we use build-in executable file "VBoxHeadless.exe".
创建文件
vm.run.bat
输入代码
cd "c:\Program Files\Oracle\VirtualBox\"
VBoxHeadless.exe -s {vm_name} -v on
运行并测试它 - 赢得名为命令行界面 (CLI)"Command shell" 将打开,VM 将在后台运行.>
run and test it - WIN "Command Line Interface (CLI)" called "Command shell" will be open and VM will running in background.
vm.run.bat
2) 然后我们使用 "基于 Windows 的脚本宿主 (WSCRIPT)" 和语言 "Microsoft Visual Basic 脚本 (VBS)"并在文件vm.run.bat"上运行.
2) Then we use "Windows-based script host (WSCRIPT)" and language "Microsoft Visual Basic Script (VBS)" and run above file "vm.run.bat" with.
创建文件
vm.run.vbs
输入代码
Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("vm.run.bat", 0)
set WshShell = Nothing
运行并测试 - CLI 将在后台运行.
run and test it - CLI will be run in background.
wscript.exe vm.run.vbs
参考资料
感谢 iain
这篇关于如何运行“Oracle VirtualBox (VBOX)"像在完全后台“Microsoft Windows (WIN)"中启动后的服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!