<?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[Is there a way to set %USERNAME% in the path?]]></title><description><![CDATA[<p dir="auto">I saved a workspace in two computers with different user names like this:</p>
<pre><code>            &lt;File name="C:\Users\MyUsername\project\filename.docx" /&gt;
</code></pre>
<p dir="auto">My question is, is there a way to let Notepad++ know the username automatically?<br />
For example, like in batch command, if you echo %USERNAME%, then " %USERNAME%" will be replaced by your actual user name.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/10987/is-there-a-way-to-set-username-in-the-path</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 18:01:32 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/10987.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 22 Dec 2015 04:11:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Is there a way to set %USERNAME% in the path? on Thu, 24 Dec 2015 01:02:19 GMT]]></title><description><![CDATA[<p dir="auto">You guys got my point although I didn’t make it clear enough. It’s a pity that npp could not get an environmental variable.<br />
Just let you know my demand better and my solution in R:</p>
<p dir="auto">library(R.utils)<br />
user		&lt;-	System$getUsername()<br />
directory 	&lt;- paste(“C:\\Users\\”, user, “\\workspace”, sep=“”)<br />
setwd(directory)</p>
<p dir="auto">With the above code, I could set the working directory correctly regardless of which computer I use, so it’s easy for me to switch different computers.</p>
<p dir="auto">I’m just a beginner of Python, however, I will learn your script <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a> .<br />
Thank you all!<a class="plugin-mentions-user plugin-mentions-a" href="/user/xp1" aria-label="Profile: XP1">@<bdi>XP1</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/claudia-frank" aria-label="Profile: Claudia-Frank">@<bdi>Claudia-Frank</bdi></a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/12770</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12770</guid><dc:creator><![CDATA[瀚程戴]]></dc:creator><pubDate>Thu, 24 Dec 2015 01:02:19 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to set %USERNAME% in the path? on Tue, 22 Dec 2015 19:38:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/xp1" aria-label="Profile: XP1">@<bdi>XP1</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/%E7%80%9A%E7%A8%8B%E6%88%B4" aria-label="Profile: 瀚程戴">@<bdi>瀚程戴</bdi></a></p>
<p dir="auto">afaik npp doesn’t expand environment variables in this case.<br />
What could be done so is to use a python script like</p>
<pre><code>import os

for _file in notepad.getSessionFiles('PATH_SESSION_FILENAME'):
    notepad.open(os.path.expandvars(_file))
</code></pre>
<p dir="auto">where PATH_SESSION_FILENAME needs to be replace with your session file, of course.</p>
<p dir="auto">If this python script should be executed right after npp started you need to copy the lines<br />
to <a href="http://startup.py" rel="nofollow ugc">startup.py</a> file and change initialisation to ATSTARTUP in python script configuration window.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12743</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12743</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Tue, 22 Dec 2015 19:38:16 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to set %USERNAME% in the path? on Tue, 22 Dec 2015 14:23:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/%E7%80%9A%E7%A8%8B%E6%88%B4" aria-label="Profile: 瀚程戴">@<bdi>瀚程戴</bdi></a>  is talking about the session file from File &gt; Save Session…</p>
<p dir="auto">It looks like Notepad++ does not resolve the path containing an environment variable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12740</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12740</guid><dc:creator><![CDATA[XP1]]></dc:creator><pubDate>Tue, 22 Dec 2015 14:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to set %USERNAME% in the path? on Tue, 22 Dec 2015 13:27:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/%E7%80%9A%E7%A8%8B%E6%88%B4" aria-label="Profile: 瀚程戴">@<bdi>瀚程戴</bdi></a><br />
There a different ways to do this. The question is what do you exactly expect?<br />
Should npp replace a variable if you open a file or if you save it or close it …<br />
Maybe you can give us a short example what you want to achive.</p>
<p dir="auto">Cheers<br />
Claudia</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12737</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12737</guid><dc:creator><![CDATA[Claudia Frank]]></dc:creator><pubDate>Tue, 22 Dec 2015 13:27:22 GMT</pubDate></item></channel></rss>