如何隐藏由"pm2 start"创建的节点cmd窗口? [英] How to hide node cmd windows created by "pm2 start"
问题描述
每个节点进程一个cmd窗口,我不知道这些窗口的用途.我可以藏起来吗?
One cmd window per node process, I don't know what these windows for. Can I hide them?
推荐答案
使用 AutoHotkey 我为我解决了这个问题在Windows上.这将在任务栏的通知区域(时钟旁边的某处)添加一个托盘图标.您还可以通过右键单击此图标,然后单击退出"来停止脚本本身和node.js脚本.
Using AutoHotkey I solved this problem for me on Windows. This will add a tray icon in the notification area of the taskbar (somewhere next to the clock). You can also stop the script itself and the node.js script by right clicking this icon then "Exit".
#SingleInstance, force
OnExit, ExitSub
RunWait, node "main.js", % A_ScriptDir, Hide, pid
ExitApp
ExitSub:
Process, close, % pid
ExitApp
使用%comspec%
,您可以根据需要将输出写入文件.这样就类似于RunWait, %comspec% /c "node "main.js" > "log.txt""
With %comspec%
you can write the output to a file if needed. This would then be something like RunWait, %comspec% /c "node "main.js" > "log.txt""
这篇关于如何隐藏由"pm2 start"创建的节点cmd窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!