I've been trying to create global commands that will run in "Command Prompt" on windows in Node.js. Unfortunately, all the tutorials seem to be for Mac/Linux. This normally wouldn't be a problem, however when I follow them exactly and just use different directory string formats and locations so it can be Windows compliant, Node.js fails to accurately parse the links.
The only way I've been able to get it to work is by going into the "Windows Command" file Node generates after running "npm link" and manually adjusting the values. This works, but seems like it isn't the best solution.
The 'directory identifier' I'm using is:
#!C:\Users\-my username-\AppData\Roaming\npm\"env node"
Generated Node.js "Windows Command" (Doesn't Work):
@IF EXIST "%~dp0\C:\Users\-username-\AppData\Roaming\npm\"env.exe" (
"%~dp0\C:\Users\-username-\AppData\Roaming\npm\"env.exe" node" "%~dp0\node_modules\Node-Command\Test.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
C:\Users\-username-\AppData\Roaming\npm\"env node" "%~dp0\node_modules\Node-Command\Test.js" %*
)
Manually adjusted Node.js "Windows Command":
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\node_modules\Node-Command\Test.js" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\node_modules\Node-Command\Test.js" %*
)
Error I'm Getting (from generated command):
@IF EXIST "C:\Users\-username-\AppData\Roaming\npm\\C:\Users\-username-\AppData\Roaming\npm\"env.exe" (