node-red.cmd does not autostart

I ask for your help. I have a PC with Win 10. If I double click on the batch file node-red.cmd the cmd window starts and everything starts, but
if I create an "event" from the scheduler to run the "node-red.cmd" batch file automatically when the PC starts, first testing the event manually (right click and run) the cmd window does not open, but on task manager I see these processes started (see photo), but they are not enough for the node red to work. can you tell me how to solve the problem? However, if I open the cmd manually, the open services are those in the attachment. A thousand thanks


When you use task scheduler, you have various options on how to start things. They will influence how/if Node-RED will run correctly.

If you choose to start Node-RED on system start, Node-RED will inherit the SYSTEM user which will not have the typical user environment variables and will have different permissions. Alternatively, you can choose a user id but will then need to provide the users password so that the service can start without intervention (since at system startup, there is no UI for users yet).

Alternatively, you can choose to start when a user logs in, in that case, you can choose your standard user and the service will inherit the env variables and will not need the user password since the user provides it on login.

The approach you take should be based on how you need the system to be used and configured which you haven't shared with us.

thank you for the tip. I had initially created a "start services" user to do all these automations. But as you say, I had to move this process under my account, I introduced autologon (because the PC must start automatically) and now it finally starts! I didn't think it was an account problem. Perhaps, as I saw in other posts, whoever installed nodered on this PC did it only for the local user and not for all users, could it be?

I would strongly recommend installing node-red under the user that will be running the service and not as a global install shown in the default documentation. Installing under the right user will greatly simplify your management of things, help you understand where everything is kept, simplify backup/recovery and will slightly strengthen your security. It also lets you have multiple instances of node-red that do not have to be the same version - facilitating the testing of Node-RED upgrades for example.

Installing globally under Windows simply adds unnecessary complexity in my opinion.

Personally, I always install Node-RED to a suitable local folder (it is "just" a node.js package after all, it can be installed anywhere) and I make the userDir configuration folder a sub-folder of the Node-RED installation folder (I always name it data but of course, it can be anything you want).

My Alternate Node-RED Installer repo on GitHub shows how I do it should you wish to do something similar.