How to set a default working directories path?

0

When I install some software it creates and uses directories in {RootDisc}/{User}/{Name}. These types of software do not even ask to choose another location. I talk about ".android", ".m2", ".PyCharm", ".matplolib" (first thirteen folders in the screenshot). How to change this default path to another? Screen

George Zorikov

Posted 2019-04-06T15:19:14.257

Reputation: 3

These are not working directories, they are configuration files for the user. I believe that it would cause you more problems than be a solution to move them somewhere else. In any case, I don't think you can change these paths, as they are most likely hard-coded into the application which creates them (the variable %DEFAULTUSERPROFILE% is probably hard-coded into it). – Daniel F – 2019-04-06T15:53:23.690

@DanielF ok, thank you. I just think it's a little bit strange that they are hard-coded in user directory. Such files are usually installed in "Program files" – George Zorikov – 2019-04-06T16:01:54.940

1In "Program Files" they place the files which are used by all users of the system. If you check the contents of .android, you will see that there are configuration files and files related to builds which the user has done. If for example .android\avd causes you problems because it is growing too much, you can use symbolic links to offload that specific folder to another partition. Maybe you could also relocate the .m2 folder this way, but I don't know if this could cause problems when Android Studio upgrades, because it could delete the entire directory and recreate it. – Daniel F – 2019-04-06T16:07:28.573

Answers

0

The folder C:\Users\<user name> is called the User Profile Folder in Windows.

You may move this folder elsewhere using this procedure:

  • Sign out pf the user account in question and sign in to another administrator account

  • Open a command prompt and enter the command below:

    wmic useraccount get name,SID
    
  • Make a note of the SID of the user

  • Open regedit and go to:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\SID
    
  • Modify the value of the item ProfileImagePath to the new path

  • In Windows Explorer, rename the original full path of the user profile folder to the new name.

If you are using OneDrive, you might need to manually change the OneDrive folder location. Other applications that already use the old folder may also malfunction and need a manual adjustment.

This operation is not recommended - only do it if you absolutely have to.

harrymc

Posted 2019-04-06T15:19:14.257

Reputation: 306 093

This can also be done in right-click Computer, then Properties, then Advanced system settings, then User Profiles where you then choose the new path (Copy To...). But I've also had it happen to me that the new path was for some reason not avaliable after a reboot and then the user got set up with a fresh environment, which is pretty scary. If you then use the same approach again to re-point your profile directory to the old one, it overwrites your old (and most valuable) profile, so I've learned not to mess around with stuff like that. – Daniel F – 2019-04-06T16:13:43.780

So I strongly advise against doing any of this. It's better to use symbolic links to offload specific folders to another partition (event though I've also had it happen to me that these disappear). – Daniel F – 2019-04-06T16:16:33.240