I have Drush 9 installed on Windows 10. I installed it via Composer using Lando.
I want to put this drush in my system path so that I can use it from cmd.exe, Powershell, and so on. I want to do this because I am trying to run Drupal Behat Extension tests with the Drush driver, which requires drush to be in the path.
What I tried
Windows 10 Control Panel -> System -> Edit environment variables
Under "User variables for MYUSERNAME", I added:
- Variable: LANDO_FRIENDS
- Value: C:\pathtowebsiteinstalledbycomposer\vendor\bin
Then I rebooted and tried to run drush:
drush : The term 'drush' 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.
So then, from PowerShell, I changed to the
\vendor\bin directory and ran
./drush. This opened up a prompt How do you want to open this file?
I don't understand why this is happening.
Here's what does work:
- I can run drush from Powershell using lando, i.e.,
lando drush status.
- I can open up a bash shell with the Windows Linux Subsystem and go to
./drush, which causes drush to load normally.
So drush is definitely installed, but how do I use it from Powershell/cmd.exe?