VirtualBox从主机启动脚本



我启动了一个虚拟机,并希望从虚拟机内部的主机启动一个脚本。我的测试脚本看起来像:

sql /nolog <<!
exit
!

当我从主机启动时:

VBoxManage --nologo guestcontrol "vmname" run --exe "pathToScript" --username xyz --password xyz

我收到一个错误:找不到sql命令。但在虚拟机中它是有效的!

为什么??

这是因为我的env变量没有加载。所以你必须在你的脚本中加载它们,比如:

. .profile  #this file contains your env variables
sql /nolog <<!
exit
!

最新更新