<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Need command to restart Notepad ++]]></title><description><![CDATA[<p dir="auto">In the file shortcuts.xml I wrote this code:</p>
<pre><code>		&lt;Command name="Restart" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;Restart.bat&lt;/Command&gt;
</code></pre>
<p dir="auto">It runs the Restart.bat file with this code:</p>
<pre><code>taskkill /f /im notepad++.exe
start notepad++.exe
</code></pre>
<p dir="auto">Is there a simpler solution to restart Notepad ++ from the menu “Run”?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17756/need-command-to-restart-notepad</link><generator>RSS for Node</generator><lastBuildDate>Sun, 17 May 2026 12:04:48 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17756.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Jun 2019 23:52:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 13:10:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> I understood))</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44228</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44228</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 13:10:20 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 12:57:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">I don’t have one, it was in response to your response about using $(NPP_DIRECTORY),<br />
which would mean you need to concatenate directory and executable wheres $(NPP_FULL_FILE_PATH) is already the complete path.<br />
Did I misunderstood something?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44225</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44225</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 04 Jun 2019 12:57:32 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 12:20:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said:</p>
<blockquote>
<p dir="auto">Just for completeness, there is also the <code>$(NPP_FULL_FILE_PATH)</code> variable.</p>
</blockquote>
<p dir="auto">Please show me an example of your solution code.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44217</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44217</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 12:20:16 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 12:13:23 GMT]]></title><description><![CDATA[<p dir="auto">Just for completeness, there is also the <code>$(NPP_FULL_FILE_PATH)</code> variable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44216</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44216</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 04 Jun 2019 12:13:23 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 09:55:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">by the way:</p>
<blockquote>
<p dir="auto">And how is such a combination of two code variants … does it violate the laws of criminal law?<br />
<code>&lt;Command name="Restart" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;cmd /c taskkill /f /im notepad++.exe &amp;&amp; start notepad++.exe&lt;/Command&gt;</code></p>
</blockquote>
<p dir="auto">lol, no, everything is legal 😉</p>
<p dir="auto">your version is correct, mine was wrong, as it keeps the cmd window open.<br />
i just have forgotten the <code>start</code> command while typing, sorry 🙏</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44204</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44204</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Tue, 04 Jun 2019 09:55:52 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 09:18:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<blockquote>
<p dir="auto">I tried to get rid of it … and you offer me to return to this?</p>
</blockquote>
<p dir="auto">the translator of @gurikbal-singh is on holiday 😁</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44201</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44201</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Tue, 04 Jun 2019 09:18:33 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 09:01:26 GMT]]></title><description><![CDATA[<p dir="auto">@gurikbal-singh said:</p>
<blockquote>
<p dir="auto">try</p>
<p dir="auto">@echo off</p>
<p dir="auto">taskkill /f /im notepad++.exe<br />
“C:\Program Files\Notepad++\notepad++.exe”</p>
<p dir="auto">cls</p>
</blockquote>
<p dir="auto">I tried to get rid of it … and you offer me to return to this?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44199</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44199</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 09:01:26 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:54:03 GMT]]></title><description><![CDATA[<p dir="auto">try</p>
<p dir="auto">@echo off</p>
<p dir="auto">taskkill /f /im notepad++.exe<br />
“C:\Program Files\Notepad++\notepad++.exe”</p>
<p dir="auto">cls</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44198</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44198</guid><dc:creator><![CDATA[rinku singh]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:54:03 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:48:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> said:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">You can use the Npp environment variable <code>$(NPP_DIRECTORY)</code>.</p>
</blockquote>
<p dir="auto">This is the most suitable way.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44195</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44195</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:48:22 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:46:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">You can use the Npp environment variable <code>$(NPP_DIRECTORY)</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44194</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44194</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:46:44 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:44:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> I always use the portable version of Notepad ++, and try not to write full paths.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44193</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44193</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:44:52 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:43:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">Ah, now I understand your point, you erased the <code>FULL_PATH_TO_YOUR\</code> part of <a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a> 's code.</p>
<p dir="auto">Well, I would say you are lucky that it works without the full path to Npp. I guess currently Npp sets its own path as the current path when it executes the command. But I would not rely on that, maybe this behaviour changes in the future.</p>
<p dir="auto">Over the years I got used to <strong>ALWAYS</strong> use <strong>fully qualified</strong> and <strong>quoted</strong> paths. This makes your scripts error proof and thus your life much more easy.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44191</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44191</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:43:43 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:27:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> I just want to get the most minimal code.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44188</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44188</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:27:18 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:30:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">You have to escape the <code>&amp;</code> characters to be compliant with the XML syntax:</p>
<pre><code>&lt;Command name="Restart" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;cmd /c taskkill /f /im notepad++.exe &amp;amp;&amp;amp; start notepad++.exe&lt;/Command&gt;
</code></pre>
<p dir="auto">But why do you want to do that? It is not necessary to explicitly launch <code>cmd.exe</code> since <code>taskkill</code> is a console command, hence <code>cmd.exe</code> is started automatically. Or, to be exact, <code>taskkill</code> is started and attached to a new console.</p>
<p dir="auto"><strong>EDIT:</strong> Forget what I wrote above, you want to start Npp after terminating the running instance, thus you need to call <code>cmd.exe</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44186</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44186</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:30:33 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 08:07:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a><br />
And how is such a combination of two code variants … does it violate the laws of criminal law?</p>
<pre><code>&lt;Command name="Restart" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;cmd /c taskkill /f /im notepad++.exe &amp;&amp; start notepad++.exe&lt;/Command&gt;
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/44184</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44184</guid><dc:creator><![CDATA[andrecool-68]]></dc:creator><pubDate>Tue, 04 Jun 2019 08:07:45 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 07:55:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a> said:</p>
<blockquote>
<p dir="auto">with the <code>/f</code> switch in <code>taskkill /f /im notepad++.exe</code>, the process will be terminated non graceful and immediately.</p>
</blockquote>
<p dir="auto">You are right. I assumed that nobody wants to loose his unsaved documents, but there may be cases.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/44182</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44182</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 04 Jun 2019 07:55:11 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 07:43:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<blockquote>
<p dir="auto">The TASKKILL command doesn’t really kill a process, instead it sends a signal to a process requesting to terminate itself.</p>
</blockquote>
<p dir="auto">not quite. with the <code>/f</code> switch in <code>taskkill /f /im notepad++.exe</code>, the process will be terminated non graceful and immediately.<br />
but your script is cool.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">you can put it directly into shortcut.xml, without an extra batch file:</p>
<pre><code>&lt;Command name="Restart" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;cmd /c taskkill /f /im notepad++.exe &amp;&amp; "FULL_PATH_TO_YOUR\notepad++.exe"&lt;/Command&gt;
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/44181</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44181</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Tue, 04 Jun 2019 07:43:27 GMT</pubDate></item><item><title><![CDATA[Reply to Need command to restart Notepad ++ on Tue, 04 Jun 2019 07:26:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andrecool-68" aria-label="Profile: andrecool-68">@<bdi>andrecool-68</bdi></a></p>
<p dir="auto">IMHO your code is even too simple. The <em>TASKKILL</em> command doesn’t really kill a process, instead it sends a signal to a process requesting to terminate itself. This way an application can show a confirmation dialog when it has unsaved data/documents. Notepad++ behaves exactly like that. Thus the <code>start notepad++</code> command may fail to start a new instance of Npp if it is set to single-instance-mode.</p>
<p dir="auto">That’s the code I use for the same purpose (VB Script). It expects as the first command line argument the path to the Npp directory.</p>
<pre><code class="language-Z">Option Explicit


'-------------------------------------------------------------------------------
'Variables declaration
'-------------------------------------------------------------------------------
Dim objFSO, objWshShell, objWMIService
Dim colProcesses, objProcess, strInstanceQuery
Dim colEvents, objEvent, strEventQuery, intInterval
Dim strNppDirPath, strNppExeName, strNppExePath


'-------------------------------------------------------------------------------
'Variables initialization
'-------------------------------------------------------------------------------
Set objFSO        = CreateObject("Scripting.FileSystemObject")
Set objWshShell   = CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2" )

strNppExeName     = "notepad++.exe"
intInterval       = 1


'-------------------------------------------------------------------------------
' Request termination of running Npp, wait for its termination and restart it
'-------------------------------------------------------------------------------
If WScript.Arguments.Count &gt; 0 Then
  strNppDirPath = WScript.Arguments(0)
  strNppExePath = objFSO.BuildPath(strNppDirPath, strNppExeName)

  If objFSO.FileExists(strNppExePath) Then
    strInstanceQuery = "SELECT * FROM Win32_Process" &amp; _
                       " WHERE ExecutablePath = '" &amp; EscapeForWMI(strNppExePath) &amp; "'"

    strEventQuery    = "SELECT * FROM __InstanceOperationEvent" &amp; _
                       " WITHIN " &amp; intInterval &amp; _
                       " WHERE TargetInstance ISA 'Win32_Process'" &amp; _
                       " AND TargetInstance.ExecutablePath = '" &amp; EscapeForWMI(strNppExePath) &amp; "'"

    Set colProcesses = objWMIService.ExecQuery(strInstanceQuery)

    For Each objProcess In colProcesses
      objWshShell.Run "taskkill /im " &amp; Quote(strNppExeName), 0, False

      Set colEvents = objWMIService.ExecNotificationQuery(strEventQuery)

      Do
        Set objEvent = colEvents.NextEvent()

        Select Case objEvent.Path_.Class
          Case "__InstanceDeletionEvent" Exit Do
        End Select
      Loop

      objWshShell.Run Quote(strNppExePath), 1, False

      Exit For
    Next
  End If
End If




'===============================================================================
' Surround a string with double quotes
'===============================================================================

Function Quote(ByRef strString)
  Quote = """" &amp; strString &amp; """"
End Function


'===============================================================================
' Escape special chars of string for using it with WMI
'===============================================================================

Function EscapeForWMI(ByRef strAString)
  EscapeForWMI = Replace(strAString, "\", "\\")
End Function
</code></pre>
<pre><code class="language-Z"></code></pre>
<p dir="auto">This is the required entry for <code>shortcuts.xml</code>:</p>
<pre><code>&lt;Command name="Restart" Ctrl="no" Alt="no" Shift="no" Key="0"&gt;wscript.exe /nologo "&lt;Path-To-Restart-Script&gt;" "$(NPP_DIRECTORY)"&lt;/Command&gt;
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/44178</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/44178</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 04 Jun 2019 07:26:31 GMT</pubDate></item></channel></rss>