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

Unable to run Vagrant commands through PowerShell script in 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 命令。

尝试将 vagrant 替换为 vagrant.exe