vboxmanage running a bat file, but doesn't see arguments

时间:2017-07-10 15:19:06

标签: batch-file virtualbox

I have a Virtualbox instance running Windows10, and am running the following command from outside of VirtualBox:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" 
    --nologo guestcontrol "Win10_x64" run 
    --exe "\\VBOXSVR\codemodel\VirtualBox_RunInstaller.bat" 
    --username user --password pass 
    --wait-stdout 
    -- VERSION5

The argument I am trying to pass to the VirtualBox_RunInstaller bat file is VERSION5, but %1 is always empty. I can see this because when set version=%1 is run, it prints out set version=. So it is successfully running the batch file, but no arguments are getting passed to it.

Have I got the syntax wrong? I've tried several variations at this point but haven't got it right yet.

1 个答案:

答案 0 :(得分:0)

如果我正确理解this link,则--exe地址为cmd.exe,批处理文件必须是第一个参数(到exe)

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" ^
    --nologo guestcontrol "Win10_x64" run ^
    --exe cmd.exe ^
    --username user --password pass ^
    --wait-stdout ^
    -- "\\VBOXSVR\codemodel\VirtualBox_RunInstaller.bat"  VERSION5
相关问题