Answer the question
In order to leave comments, you need to log in
How to add path part to .cmd?
I have windows 8 with nodejs installed globally.
At D:\projs\current_proj\node_modules\.bin\ there are
two files sails.cmd and sails -
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\sails\bin\sails.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\sails\bin\sails.js" %*
)
#!/bin/sh
basedir=`dirname "$0"`
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sails/bin/sails.js" "[email protected]"
ret=$?
else
node "$basedir/../sails/bin/sails.js" "[email protected]"
ret=$?
fi
exit $ret
D:\projs\current_proj\server> D:\projs\current_proj\node_modules\.bin\sails generate ...
Answer the question
In order to leave comments, you need to log in
Maybe I did not quite understand the question, but what prevents you from prescribing all the paths hard?
UPD:
Well, something like this: "% ~ dp0" is the path from where the cmd file is launched. The first two commands set the current folder - where the files will be generated, and then change "% ~ dp0" to its constant value.
@D:
@CD "D:\projs\current_proj\server"
@IF EXIST "D:\projs\current_proj\node_modules\.bin\node.exe" (
"D:\projs\current_proj\node_modules\.bin\node.exe" "D:\projs\current_proj\node_modules\sails\bin\sails.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "D:\projs\current_proj\node_modules\sails\bin\sails.js" %*
)
@CD "D:\projs\current_proj\node_modules\.bin"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question