[英]Unable to run Vagrant commands through PowerShell script in VirtualBox
I try to run these 2 commands in the end of big script in Windows 10 which is installed in VirtualBox:我尝试在安装在 VirtualBox 中的 Windows 10 中的大脚本末尾运行这 2 个命令:
#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
But I receive an error:但我收到一个错误:
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
But I can run these commands via PowerShell and PowerShell ISE severally.但是我可以分别通过 PowerShell 和 PowerShell ISE 运行这些命令。 Also, I don't know why, PowerShell is executed Vagrant commands with comment lines.
另外,我不知道为什么,PowerShell 执行带有注释行的 Vagrant 命令。
尝试用vagrant.exe
替换vagrant
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.