Is there any way to create an shortcut desktop to a Node.js (npm) application?
11,032
Solution 1
**SOLVED**
An .bat file, renamed as "appstart.bat"
cd C:\Users\MyUser\MyApp
npm start
With shortcut in desktop.
Solution 2
Because Node-Red is usually installed globally _
a Node-Red.bat
file could simply be
cd \
Node-Red
then use convertico.com to change the Node-Red.png file to Node-Red.ico.
Slick Willy
Solution 3
You can also create a shortcut and set "Target" to...
C:\Windows\System32\cmd.exe /k "node index.js"
... and set "Start In" to the directory index.js is in.
Comments
-
Ulises Vargas De Sousa over 1 year
Inexperienced users want to "see" the app that I've created in Node.js, but they don't want to use the console. According to them, it's a good idea to install it, and with a simple click, in desktop, they could "see" it.
They want to run the Node.js app as a Windows program. That's all!
How can I do it? Should I create a batch file?
-
aschipfl about 7 yearsI would add the
/D
switch tocd
to avoid trouble when the current working directory resides on another drive; and ifnpm
is a batch file on its own, prependcall
(it does not actually make a difference here, becausenpm
is the last command line anyway, but if you put more commands here afterwards, execution only returns to this batch file withcall
; in casenpm
is an executable, forget about all of this)... -
Ulises Vargas De Sousa about 7 yearsThis is assuming that user install node.js for Windows and stores the app in C:\Users\MyUser. For my particular case, is it.
-
THE JOATMON almost 2 yearsThis is the best answer as it eliminates the need for yet another script (batch file).