Title: Set wp-cli environment variable WP_CLI_PACKAGES_DIR on Windows?
Last modified: June 9, 2017

---

# Set wp-cli environment variable WP_CLI_PACKAGES_DIR on Windows?

 *  Resolved [Happy Coder](https://wordpress.org/support/users/lovemesomecode/)
 * (@lovemesomecode)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/set-wp-cli-environment-variable-wp_cli_packages_dir-on-windows/)
 * Hello.
 * Installed wp-cli on Windows following the [Install via Composer – Global require](http://the https://make.wordpress.org/cli/handbook/installing/#installing-via-composer)
   method with following command `composer global require wp-cli/wp-cli`.
 * It worked fine and when I type `wp --info` I get:
 *     ```
       PHP binary:     D:\XAMPP\php\php.exe
       PHP version:    5.6.8
       php.ini used:   D:\XAMPP\php\php.ini
       WP-CLI root dir:        phar://wp-cli.phar
       WP-CLI packages dir:
       WP-CLI global config:
       WP-CLI project config:
       WP-CLI version: 1.1.0
       ```
   
 * Now I would like to install [a wp-cli package](https://github.com/iandunn/wp-cli-rename-db-prefix)
   but cannot since the `WP-CLI packages dir` is not set or missing. When I try 
   to install the package I get following error: `Error: Composer directory for 
   packages couldn't be created.`
 * I found out that I [can set the wp-cli environment variables](https://make.wordpress.org/cli/handbook/config/#environment-variables)
   however it does not say how to do this on Windows.
 * Is there a way to set `WP-CLI packages dir` on Windows?

Viewing 1 replies (of 1 total)

 *  Thread Starter [Happy Coder](https://wordpress.org/support/users/lovemesomecode/)
 * (@lovemesomecode)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/set-wp-cli-environment-variable-wp_cli_packages_dir-on-windows/#post-9213689)
 * Due to help from [@schlessera](https://wordpress.org/support/users/schlessera/)
   and [@danielhuesken](https://wordpress.org/support/users/danielhuesken/) on the#
   cli WordPress Slack channel I found out what I had to do.
 * Instead of setting a PATH value in the Windows environment variables I had to
   make a **new** variable called `WP_CLI_PACKAGES_DIR` and set the value of that
   variable to `C:\Users\YOUR_WINDOWS_YOURSERNAME_HERE\.wp-cli\packages`.
 * I also had to create the folder `packages` under `C:\Users\YOUR_WINDOWS_YOURSERNAME_HERE\.
   wp-cli\`. The folder was not created automatically.
 * After that though Composer was complaining that PHP does not have enough memory
   and so I permanently increased the memory from `128M` to `512M` in the php.ini
   file.
 * Now I could install the wp-cli package just fine, ran it and it also worked perfectly.
 * Reference links:
    [https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10](https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10)
 * [https://make.wordpress.org/cli/handbook/common-issues/#php-fatal-error-allowed-memory-size-of-999999-bytes-exhausted-tried-to-allocate-99-bytes](https://make.wordpress.org/cli/handbook/common-issues/#php-fatal-error-allowed-memory-size-of-999999-bytes-exhausted-tried-to-allocate-99-bytes)

Viewing 1 replies (of 1 total)

The topic ‘Set wp-cli environment variable WP_CLI_PACKAGES_DIR on Windows?’ is closed
to new replies.

## Tags

 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 1 participant
 * Last reply from: [Happy Coder](https://wordpress.org/support/users/lovemesomecode/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/set-wp-cli-environment-variable-wp_cli_packages_dir-on-windows/#post-9213689)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
