# Run Notepad.exe using nssm

**URL:** https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068
**Category:** General
**Created:** [4 January 2022 06:06 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068 "2022-01-04T06:06:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![gunkatzu](https://avatars.discourse-cdn.com/v4/letter/g/bc79bd/32.png) [@gunkatzu](https://discourse.nodered.org/u/gunkatzu)
#### Post date: [4 January 2022 06:06 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068/1 "2022-01-04T06:06:19Z")

</div>

How can i call and show notepad.exe in my desktop?  
i run my node red with nssm service and used exec node to call notepad.. but notepad only show in background (pid process)

can anyone help me ? thanks

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [4 January 2022 12:54 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068/2 "2022-01-04T12:54:06Z")

</div>

If you are running Node-RED under nssm, you probably have it in the SYSTEM context rather than a user. That means that if you simply try to run "notepad.exe" in an exec node, it won't find it.

From a standard PowerShell command prompt, try running `whereis notepad.exe`. For me, that gives:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96f2a671169c149ea462bd321e6c21c2e4abc891.png)

So using either of those full paths in exec should work.

In general, when running commands from an uncertain context, you should always use absolute file paths and not rely on the shortcuts that users may get.

---

<div class="post-metadata">

### Author: ![gunkatzu](https://avatars.discourse-cdn.com/v4/letter/g/bc79bd/32.png) [@gunkatzu](https://discourse.nodered.org/u/gunkatzu)
#### Post date: [8 January 2022 00:10 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068/3 "2022-01-08T00:10:07Z")

</div>

hi, thanks for your advice and sorry for my late responds

I've tried changing my program, but I still get the result that notepad is running in the background

how do I get it to run on the desktop (foreground)?

Regards..

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [8 January 2022 06:21 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068/4 "2022-01-08T06:21:50Z")

</div>

Your question really begs the question "why". Why are you trying to launch notepad from node-red?

To answer your question - you will need to edit the nssm service and enter the username and password of the logged on user to run node-red. That way, when node-red runs, it runs under the correct account and notepad (when launched from node-red) runs in the same user context.

NOTE: you should export/backup your flows before doing this because when you run node-red under a different account you will get a different set of flows (i.e. node-red will be blank).

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [8 January 2022 12:05 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068/5 "2022-01-08T12:05:02Z")

</div>

> [@Steve-Mcl](#):
>
> To answer your question - you will need to edit the nssm service and enter the username and password of the logged on user to run node-red. That way, when node-red runs, it runs under the correct account and notepad (when launched from node-red) runs in the same user context.

I actually think it would be better to construct a PowerShell wrapper that changes the user context. Still not sure even that would work though if the service is being run from the SYSTEM context since I'm not sure that even gets a GUI assigned. I'm sure that the mighty Google will turn up someone who has done something similar.

---

<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: [9 March 2022 12:05 UTC](https://discourse.nodered.org/t/run-notepad-exe-using-nssm/56068/6 "2022-03-09T12:05:42Z")

</div>

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