无法通过VirtualBox中的PowerShell脚本运行Vagrant命令

时间:2016-06-21 09:55:53

标签: powershell vagrant virtualbox

我尝试在VirtualBox中安装的Windows 10中的大脚本末尾运行这两个命令:

#Navigate to folder where Vagrant file will be placed

CD "D:\VagrantBoxes\Win8"

#mount Windows box

vagrant init windows_81x64-enterprise_virtualbox_15.07.17.box

#run Vagrant

vagrant up

但我收到错误:

vagrant : The term 'vagrant' is not recognized as the name of a cmdlet,  function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is 
correct and try again.
At F:\Scripts\Install_Vagrant.ps1:3 char:1
+ vagrant up
+ ~~~~~~~
+ CategoryInfo          : ObjectNotFound: (vagrant:String) [],   CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

但我可以分别通过PowerShell和PowerShell ISE运行这些命令。此外,我不知道为什么,PowerShell使用注释行执行Vagrant命令。

2 个答案:

答案 0 :(得分:2)

尝试将vagrant替换为vagrant.exe

答案 1 :(得分:1)

对我来说vagrant.exe无法解决问题