2
\$\begingroup\$

I am tired of typing "cd c:\socket\nodejs" "node testserver.js"

Into the command promt..

How do I create a shortcut or bat for it?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ you create .bat file and write these two lines into it :) \$\endgroup\$ Commented Oct 24, 2012 at 8:33
  • \$\begingroup\$ @Kikaimaru Exactly. You should post this as an answer! \$\endgroup\$ Commented Oct 24, 2012 at 8:34
  • \$\begingroup\$ @Laurent Couvidou: I think there are better ways, like automatic restart when you change .js files or running it from webstorm and seeing output in IDE, maybe someone will write some of them in more verbose answer :) \$\endgroup\$ Commented Oct 24, 2012 at 8:40
  • \$\begingroup\$ @Kikaimaru Thank you for the idea of an automatic restart when changed. I will look that up! \$\endgroup\$ Commented Oct 25, 2012 at 16:39

1 Answer 1

0
\$\begingroup\$

To do exactly as you asked, create a .bat file and inside type:

cd c:\socket\nodejs
node testserver.js

But what I would suggest is installing this thing I came across the other day called Lineman. It makes use of Grunt to automatically check for file updates on the fly. It also has built in support for Test'Em which makes unit testing a breeze. Using all of this, you could write a batch script more like this:

cd c:\socket\nodejs
lineman run

then just go from there without even needing to run node periodically. Furthermore, you could create a second batch like so:

cd c:\socket\nodejs
lineman spec

and keep that open so you can check in and make sure all of your unit tests are always passing.

\$\endgroup\$
2
  • \$\begingroup\$ Thank you for your answer :) I will look the Lineman up, but probably go with your first answer on how to create a Bat File because I like to check the Client-Side while the server is running, and the Lineman sounds more like a debugger. \$\endgroup\$ Commented Oct 25, 2012 at 16:38
  • \$\begingroup\$ No problem :) And Lineman can be used as a debugger of sorts but it's really intended for client and server side stuff. Any time you modify any of your js files it essentially "restarts." So you wouldn't need to shut down testserver.js and reboot it every time you modify it. Same goes for any of your other scripts that are run through testserver.js. Glad I could help. \$\endgroup\$ Commented Oct 25, 2012 at 16:41

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.