我要用bat 打开node.exe,bat文件怎么写?
4 回复
可以打开呀.我就是这样做的呀.
node.exe的路径没有被加到环境变量里去吧,加一行 cd [路径名] 即可。
例: cd C:\Program Files\nodejs node.exe
start node.exe
@echo off echo.
set NodePackagesPath=E:\Projects\OpenShift\Materials\Node.js
set Path=%NodePackagesPath%\node_modules.bin;%PATH% set Path=%NodePackagesPath%;%PATH%
set NODE_PATH=%NodePackagesPath%\node_modules;%NODE_PATH% set NODE_ENV=production
echo Environment variables are successfully added. echo. echo. echo.
node server.js
http://stackoverflow.com/questions/20220477/run-node-server-with-a-bat-file