Search code examples
node.jswindowspowershellgulpubuntu-16.04

Running gulp and set environment in Windows


I am using Windows 10 Pro. Recently I changed from Ubuntu to Windows 64-bit. In Ubuntu I ran node.js applications by setting the environment variable and using node.js package gulp. Now I don't know how to run both commands at a time in Command Prompt or Windows PowerShell. I installed git-bash and Cygwin too.

Below I'm providing the command which I used in Ubuntu. I searched Google and Github. Nothing helped me. I installed gulp globally.

Command is env ENV=development gulp in Ubuntu.


Solution

  • Defining a (volatile) environment variable and executing a command in CMD:

    set "ENV=development"
    gulp
    

    In one line:

    set "ENV=development" & gulp
    

    Defining a (volatile) environment variable and executing a command in PowerShell:

    $env:ENV = 'development'
    & gulp
    

    In one line:

    $env:ENV = 'development'; & gulp