cmd - Dynamic user home directory on Windows (changing %HOMEDRIVE% and %HOMEPATH%) -


How can I "redirect" (symbolic link?) Or temporarily % HOMEDRIVE% and % HOMEPATH% (Maybe the values ​​which change based on two batch scripts when I start working on the machine and Reset everything later)?

Background

Many Windows programs either choose a combination of system variable % USERPROFILE% or % HOMEDRIVE% and % HOMEPATH to find out that the user has a "home" directory that needs to be used (like C: \ users \ JohnDoe ). Being a fan of the portable app (see below what I mean), I am thinking that I can make my home directory portable in any way, that is, it is pointing to a directory A portable device or, in other words, I would like to "change it dynamically"

I tried that

I have read a bit and have tried it :

What is the current variable value :

<\ Users \ Saurabh & gt;:> C Set East Home Homdaiv = C: HOMEPATH = \ user \ & lt; Username & gt;

Set them:

  C: \ Users \ John doo> Sachs HomeDrive "d:" C: \ Users \ John Do & gt; Syxsec Homepath "Home"  

This creates the HOMEDIR and HOMEPATH as the user-specific environment variable (see Control Panel >> System>> environmental variable) but did not change "global people" and e.g. RStudio will not recognize user-specific variables (even for C: \ users \ JohnDoes \ [...] ).

  C: \ Users \ JohnDoe> Set Home HomeDive = C: HOMEPATH = \ User \ & lt; Username & gt;  

Portable app

For example, look at portable APPS dots or just thought "software that is installed on portable devices instead of C Done: \ program files \ & lt; app-name & gt; ". The latter treats those programs in a way that does not really care about % HOMEDRIVE% and % HOMEPATH% (like or).

Some other (for example) just need to be slightly tweaked (see like).

Still some other (for example) run easily from portable devices, but write content in the user's "Home" directory. There is a software that I want to tell about using a directory on my portable device instead.

When you can change the environment variable, it does not work for all applications, because windows There is also a Shell Folder API that gives different user specific places.

So it is better to use the actual Windows method to change profile. And it is possible to not have such a mobile device because it expects a stable and available location for the user's registry database.

I think that when the window is set (and with sysprep) for any user} folder the location (different drives) are the fastest thing to have special library folders, in the Explorer properties view They can change their location.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -