简体   繁体   中英

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:

#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. Also, I don't know why, PowerShell is executed Vagrant commands with comment lines.

尝试用vagrant.exe替换vagrant

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM