Skip to content

Instantly share code, notes, and snippets.

@zjaml
Forked from joeyespo/npm-exec.bat
Created April 19, 2017 04:20
Show Gist options
  • Save zjaml/e4a6aff5655465c810c499a22ebc4118 to your computer and use it in GitHub Desktop.
Save zjaml/e4a6aff5655465c810c499a22ebc4118 to your computer and use it in GitHub Desktop.
Execute a node_modules/.bin script on Windows.
@ECHO OFF
SETLOCAL
REM Speed up by checking for bin directory directly
IF NOT EXIST node_modules\.bin GOTO FINDBIN
SET BIN=.\node_modules\.bin
GOTO RUN
:FINDBIN
REM Find the current bin directory from npm, storing the result in 'BIN'
FOR /f "delims=" %%i IN ('npm bin') DO SET BIN=%%i
:RUN
SET PATH=%BIN%;%PATH%
REM Run the arguments passed into this script, including the script name
%*
ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment