# From its-posible-open-a-program-from-node-red-in-windows/21734 \<with NSSMService\>

**URL:** <https://discourse.nodered.org/t/from-its-posible-open-a-program-from-node-red-in-windows-21734-with-nssmservice/47419>\
**Category:** General\
**Created:** [21 June 2021 07:02 UTC](https://discourse.nodered.org/t/from-its-posible-open-a-program-from-node-red-in-windows-21734-with-nssmservice/47419 "2021-06-21T07:02:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hotkhwan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotkhwan/32/43625_2.png) [@hotkhwan](https://discourse.nodered.org/u/hotkhwan)\
**Post date:** [21 June 2021 07:02 UTC](https://discourse.nodered.org/t/from-its-posible-open-a-program-from-node-red-in-windows-21734-with-nssmservice/47419/1 "2021-06-21T07:02:08Z")

</div>

This good community  
I has same this case for NSSM service nodered on windows  
It run as system  
Share my solution: Use windows task scheduler for resolve it  
Example Code

```auto
[{"id":"37ec7f9a.24e02","type":"file","z":"d9b656f2.6c03d8","name":"Create CMD FIle","filename":"url.cmd","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"utf8","x":590,"y":200,"wires":[["c93e4ec5.73507"]]},{"id":"ef283802.f5a458","type":"inject","z":"d9b656f2.6c03d8","name":"Run CMD","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"SCHTASKS /Run /tn MyTasks","payloadType":"str","x":100,"y":200,"wires":[["f93d5c43.f9b1a"]]},{"id":"f93d5c43.f9b1a","type":"exec","z":"d9b656f2.6c03d8","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":230,"y":200,"wires":[["6f50b50e.4ecf7c"],[],[]]},{"id":"315a884f.6e73e8","type":"exec","z":"d9b656f2.6c03d8","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":650,"y":80,"wires":[["1ed88855.610988"],[],[]]},{"id":"54fefd39.dd9b14","type":"inject","z":"d9b656f2.6c03d8","name":"Change CMD Open Youtube","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"start chrome www.youtube.com","payloadType":"str","x":160,"y":260,"wires":[["37ec7f9a.24e02"]]},{"id":"60199e0c.1b99d","type":"inject","z":"d9b656f2.6c03d8","name":"Change CMD Open Google","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"start chrome www.google.com","payloadType":"str","x":160,"y":140,"wires":[["37ec7f9a.24e02"]]},{"id":"1ed88855.610988","type":"debug","z":"d9b656f2.6c03d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":80,"wires":[]},{"id":"386b1e8e.1c0442","type":"exec","z":"d9b656f2.6c03d8","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Get User ","x":300,"y":80,"wires":[["20b19f28.75853"],[],[]]},{"id":"8b11c35b.b97be","type":"inject","z":"d9b656f2.6c03d8","name":"Create Task Schdule","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"WMIC /NODE:127.0.0.1 COMPUTERSYSTEM GET USERNAME","payloadType":"str","x":130,"y":80,"wires":[["386b1e8e.1c0442"]]},{"id":"20b19f28.75853","type":"function","z":"d9b656f2.6c03d8","name":"Create TaskSchdule","func":"var path = msg.payload.split(\"\\n\")[1].split(\" \")[0]\nvar user = msg.payload.split(\"\\n\")[1].split(\" \")[0].split(\"\\\\\")[1]\nvar schdule = \"SCHTASKS /CREATE /SC ONCE /TN MyTasks /ru \"+path+\" /TR C:\\\\Users\\\\\"+user+\"\\\\.node-red\\\\url.cmd /ST 12:00\"\nmsg.payload = schdule\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":80,"wires":[["315a884f.6e73e8"]]},{"id":"c93e4ec5.73507","type":"debug","z":"d9b656f2.6c03d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":200,"wires":[]},{"id":"6f50b50e.4ecf7c","type":"debug","z":"d9b656f2.6c03d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":350,"y":200,"wires":[]},{"id":"b94d903e.8d242","type":"exec","z":"d9b656f2.6c03d8","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":290,"y":320,"wires":[["dd9e1017.291df"],[],[]]},{"id":"dd9e1017.291df","type":"debug","z":"d9b656f2.6c03d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":410,"y":320,"wires":[]},{"id":"ceb58b54.fdbcb8","type":"inject","z":"d9b656f2.6c03d8","name":"Delete Task Schdule","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"SCHTASKS /DELETE /TN \"MyTasks\" /F","payloadType":"str","x":130,"y":320,"wires":[["b94d903e.8d242"]]}]

```

May be help someone

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 August 2021 07:03 UTC](https://discourse.nodered.org/t/from-its-posible-open-a-program-from-node-red-in-windows-21734-with-nssmservice/47419/2 "2021-08-20T07:03:05Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
