Skip to content

Instantly share code, notes, and snippets.

@armornick
Last active August 29, 2015 14:20
Show Gist options
  • Save armornick/0f422b4aa8db092952a9 to your computer and use it in GitHub Desktop.
Save armornick/0f422b4aa8db092952a9 to your computer and use it in GitHub Desktop.
Portable Node Shell script for Windows
@echo off
:: set the local configuration directory --------------
:: NOTE: also change nodevars.bat to use this instead of %APPDATA%
set NODE_PORTABLE_PREFIX=%~dp0local
:: NPM CONFIGURATIOn ----------------------------------
:: set npm_config_key=value
:: ----------------------------------------------------
set npm_config_prefix=%NODE_PORTABLE_PREFIX%
set npm_config_depth=0
set npm_config_cache=%~dp0cache
:: only use offline cache
:: set npm_config_cache_min=999999
:: if there are NO arguments, call shell
:: otherwise, just set variables
if "%1" == "" (
:: START SHELL ---------------------------------------
cmd /k %~dp0nodejs\nodevars.bat
) else (
:: call variables -------------------------------------
%~dp0nodejs\nodevars.bat
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment