<h2>Actual question</h2>
How can I "redirect" (symbolic links?) or temporarily change the values of
and
(maybe based on two batch scripts that change the values when I start working at the machine and reset everything after I'm done)?
<h2>Background</h2>
A lot of Windows programs pick up either system variable
or a combination of
and
in order to figure out where a user's "home" directory is that they need to use (e.g.
). Being a fan of the philosophy of <em>portable apps</em> (see at the bottom what I mean by that), I'm wondering if I could somehow make my home directory portable, i.e. have it point to a directory on a portable device. Or, in other words, I would like to make it "dynamically changeable".
<h2>What I tried</h2>
I've read a bit about <a href="http://ss64.com/nt/set.html" rel="nofollow">
</a> and <a href="http://technet.microsoft.com/en-us/library/cc755104.aspx" rel="nofollow">
</a> and tried this:
Finding out what the current variable values are:
Set them:
That creates
and
as user-specific environment variables (see Control Panel >> System >> Environment Variables). But the "global ones" did not change and e.g. RStudio will not recognize the user-specific variables (still writes to
).
<hr>
<h2>Portable Apps</h2>
For example, see PortableApps.com or simply think "software that simply has been installed to a portable device instead of
". The latter works a treat for me for programs that don't really care about
and
(e.g. <a href="https://www.eclipse.org/" rel="nofollow">Eclipse</a> or <a href="http://www.r-project.org/" rel="nofollow">R</a>).
Some others (e.g. <a href="http://git-scm.com/" rel="nofollow">Git</a>) just need to be tweaked a little bit (e.g. see <a href="http://danlimerick.wordpress.com/20...s-tip-setting-home-and-the-startup-directory/" rel="nofollow">this post</a>).
Yet some others (e.g. <a href="http://www.rstudio.com/" rel="nofollow">RStudio</a>) run in fact smoothly off the portable device, but write stuff to the user's "home" directory. That's the kind of software that I would like to tell to use a directory on my portable device instead.
How can I "redirect" (symbolic links?) or temporarily change the values of
Code:
%HOMEDRIVE%
Code:
%HOMEPATH%
<h2>Background</h2>
A lot of Windows programs pick up either system variable
Code:
%USERPROFILE%
Code:
%HOMEDRIVE%
Code:
%HOMEPATH
Code:
C:\Users\JohnDoe
<h2>What I tried</h2>
I've read a bit about <a href="http://ss64.com/nt/set.html" rel="nofollow">
Code:
Set
Code:
Setx
Finding out what the current variable values are:
Code:
C:\Users\JohnDoe> Set HOME
HOMEDRIVE=C:
HOMEPATH=\Users\<username>
Set them:
Code:
C:\Users\JohnDoe> Setx HOMEDRIVE "d:"
C:\Users\JohnDoe> Setx HOMEPATH "\home"
That creates
Code:
HOMEDIR
Code:
HOMEPATH
Code:
C:\Users\JohnDoes\[...]
Code:
C:\Users\JohnDoe> Set HOME
HOMEDRIVE=C:
HOMEPATH=\Users\<username>
<hr>
<h2>Portable Apps</h2>
For example, see PortableApps.com or simply think "software that simply has been installed to a portable device instead of
Code:
C:\Program Files\<app-name>
Code:
%HOMEDRIVE%
Code:
%HOMEPATH%
Some others (e.g. <a href="http://git-scm.com/" rel="nofollow">Git</a>) just need to be tweaked a little bit (e.g. see <a href="http://danlimerick.wordpress.com/20...s-tip-setting-home-and-the-startup-directory/" rel="nofollow">this post</a>).
Yet some others (e.g. <a href="http://www.rstudio.com/" rel="nofollow">RStudio</a>) run in fact smoothly off the portable device, but write stuff to the user's "home" directory. That's the kind of software that I would like to tell to use a directory on my portable device instead.