Drupal Console on Windows

Installing on Windows 10

Tagged: DrupalMonday, January 22, 2018

Drupal Console Running on Windows 10

The Drupal Console is a handy command-line utility for working on Drupal 8 sites. It can help maintain a site and also with default boiler plate module code that can be a pain to create.

Getting it running on windows is a bit of a task. But here are the quick steps I took to get it working.

What You Should have Already Setup

You'll need a few things already setup before these steps will help you.

  • Install Composer and get that working
  • Install PHP and add it to your PATH
  • Have a Drupal 8 site managed with Composer

For more help see my previous post Getting Drupal 8 with Composer Running on Windows 10

Composer Require

Require drupal console in your site.

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader --sort-packages

Download Drupal Console

Head over to https://drupalconsole.com/installer and save the file to your computer. I choose C:/drupal-console/drupal.phar

Next create a new text file and paste the following

@php.exe "C:\drupal-console\drupal.phar" %*

Save the file as drupal.bat

Edit your windows PATH and add C:/drupal-console, after that open up a new cmd.exe and you should be able to test it by running drupal site:status in the Drupal 8 directory.