Created
December 7, 2016 10:10
-
-
Save windperson/816960bff4e4173dcb1cd77a4ee30b11 to your computer and use it in GitHub Desktop.
Node.js command line for Windows CMD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set npm_config_home=%cd%\npm\home | |
set npm_config_prefix=%cd%\npm | |
set npm_config_userconfig=%cd%\npm\home\npmrc | |
SET HOME=%npm_config_home% | |
SET NODE_PATH=%npm_config_prefix%\node_modules;%ProgramFiles%\nodejs\node_modules;%NODE_PATH% | |
rem Ensure this Node.js and npm are first in the PATH | |
set PATH=%cd%\npm;%~dp0;%PATH% | |
set PYTHONPATH=C:\Python\Python27\python.exe | |
set PYTHON=C:\Python\Python27\python.exe | |
setlocal enabledelayedexpansion | |
pushd "%~dp0" | |
rem Figure out the node version. | |
set print_version=node -p -e "process.versions.node + ' (' + process.arch + ')'" | |
for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v | |
rem Print message. | |
if exist npm.cmd ( | |
echo Your environment has been set up for using Node.js !version! and npm. | |
) else ( | |
echo Your environment has been set up for using Node.js !version!. | |
) | |
popd | |
endlocal | |
rem If we're in the node.js directory, change to the user's home dir. | |
if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%" | |
PROMPT $E[32m$E]9;8;"USERNAME"$E\@$E]9;8;"COMPUTERNAME"$E\$S$E[92m$P$E[90m$_$E[90m$G$E[m$S |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment