2016-06-21 95 views
1

命令我尝试运行它安装在VirtualBox的大脚本在Windows 10月末这两个命令:无法运行的流浪汉在PowerShell脚本在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 

但是我收到一个错误:

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命令。

+0

无业游民,以取代vagrant可能不是在路径。只需编写'$ env:path -split';''并检查vagrant bin目录是否存在 –

+0

Martin,这里是输出 PS C:\ VagrantBoxes \ Win8> $ env:path -split';' C:\ Windows \ System32下 C:\ WINDOWS C:\ WINDOWS \ SYSTEM32 \ WBEM C:\ WINDOWS \ SYSTEM32 \ WindowsPowerShell \ V1.0 \ C:\ ProgramData \的巧克力\斌 C:\ HashiCorp \ Vagrant \ bin C:\ PROGRA〜2 \ Oracle \ VirtualBox 所以是的,Vagrant bin在那里。 –

+0

马丁,它的工作!再次感谢 - PowerShell上帝! –

回答

2

尝试用vagrant.exe

+1

是的,问题是在.exe文件扩展名。所以你需要在每个Vagrant命令后添加.exe。 –