<?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[Changing default directory]]></title><description><![CDATA[<p dir="auto">When I start up notepad, it starts with a default CURRENT_DIRECTORY variable that is pointed to the location where the Notepad++ executable is found. I keep my c files in a different directory. Notepad++ is unable to compile the c-files I have defined because the CURRENT_DIRECTORY variable is set to the wrong place. Is there a way to change the value of the CURRENT_DIRECTORY variable? Thanks.</p>
<p dir="auto">David</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17423/changing-default-directory</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 06:16:54 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17423.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 08 Apr 2019 17:56:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Changing default directory on Tue, 09 Apr 2019 17:24:52 GMT]]></title><description><![CDATA[<p dir="auto">Thanks. I seem to have it working now.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42097</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42097</guid><dc:creator><![CDATA[padre]]></dc:creator><pubDate>Tue, 09 Apr 2019 17:24:52 GMT</pubDate></item><item><title><![CDATA[Reply to Changing default directory on Mon, 08 Apr 2019 19:13:26 GMT]]></title><description><![CDATA[<p dir="auto">Okay, able to revisit for a couple more minutes: if you need it to be in <strong>Run &gt; Run</strong> rather than NppExec, starting from <code>cmd /c cd /d "$(CURRENT_DIRECTORY)" &amp;&amp; dir "$(FILE_NAME)" &amp;&amp; echo change the dir and this last echo into just the compiler.exe -o "$(NAME_PART).exe" "$(FILE_NAME)" or whatever &amp;&amp; pause</code> as the command should get what you want.</p>
<p dir="auto">Really, it would simplify down to <code>cmd /c cd /d "$(CURRENT_DIRECTORY)" &amp;&amp; compiler.exe -o "$(NAME_PART).exe" "$(FILE_NAME)" &amp;&amp; pause</code> – I just had the others to show some more placeholders.</p>
<p dir="auto">But still, if possible, I’d recommend NppExec for anything beyond a one-liner (if it needs <code>&amp;&amp;</code> to make it work in Run&gt;Run, NppExec will be able to maintain it better)<br />
`</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42063</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42063</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 08 Apr 2019 19:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to Changing default directory on Mon, 08 Apr 2019 18:28:49 GMT]]></title><description><![CDATA[<p dir="auto">Welcome, <a class="plugin-mentions-user plugin-mentions-a" href="/user/padre" aria-label="Profile: padre">@<bdi>padre</bdi></a>, to the Notepad++ Community forums</p>
<p dir="auto">In <strong>Settings &gt; Preferences &gt; Default Directory</strong>, do you have it set to <code>☑ Follow current document</code>?</p>
<p dir="auto">Also, what are you using to run the compiler?  <strong>Run &gt; Run</strong>?  Or <strong>Plugins &gt; NppExec &gt; Run</strong>?  What command are you passing to that?</p>
<p dir="auto">If you’re doing something that just relies on one source file and calling in the right directory, <strong>Run&gt;Run</strong> of <code>cmd /c gcc "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe"</code> could do it…</p>
<p dir="auto">For anything more complicated than a one-line command, or anything where directory is critical, I will tend to use NppExec rather than the default Run menu.  I usually start with a <code>cd $(CURRENT_DIRECTORY)</code> to make sure that NppExec’s shell moves to be the same as the directory for the current file.  For example, to compile then run a c program using a gcc which is in my path,</p>
<pre><code>npp_save
cd "$(CURRENT_DIRECTORY)"
gcc "$(FILE_NAME)" -o "$(NAME_PART)"
npp_run cmd.exe /k "$(NAME_PART)"
</code></pre>
<p dir="auto">I did a quick experiment: When I have 7.6.4 x64 set to that setting, using <strong>Run &gt; Run</strong> to <code>cmd /c echo $(CURRENT_DIRECTORY) &amp;&amp; pause</code>, it shows the correct value for the $(CURRENT_DIRECTORY) variable.  However, if I switch to <code>cmd /k echo $(CURRENT_DIRECTORY) &amp;&amp; pause</code>, when it drops to the command line, the working directory is the notepad++.exe executable directory instead.  SO it definitely needs the CD.  I don’t have time at this moment to debug more and get a command that will work in the <strong>Run&gt;Run</strong> and do the CD before issuing some other command.  (Still, like I said, for multi-command sequences, NppExec is better; I also prefer it, because the results window is embedded in Notepad++, rather than spawning an external cmd.exe, which you have to be careful with /k vs /c and <code>&amp;&amp; pause</code> to try to keep the results in a window before it disappears.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42062</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42062</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 08 Apr 2019 18:28:49 GMT</pubDate></item></channel></rss>