0

I am trying to create a script that moves some of the windows known folders to other locations/drives, I have succeed moving RoamingAppData but failed on LocalAppData

I am using this script to change the location, but it gives me an error when run on LocalAppData.

On RoamingAppData, the script Returns a 0 and the location of RoamingAppData changed, even if the shortcut %appdata% stopped pointing to anything.

But when I try the same with LocalAppData, the script returns -2147024809 which I haven't been able to trace anywhere, on the support page for the core function the script uses there is nothing about error numbers, and google search didn't even find anything related with the number on it.

Is there any other way of changing the location of LocalAppData using PowerShell?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Laikar
  • 333
  • 1
  • 3
  • 9
  • 3
    Windows error codes are usually expressed (by humans, anyhow) in hexadecimal, whereas sometimes programs spit them out in decimal as you see here. If you run `(-2147024809).ToString('X2')` you get `80070057`, which will likely yield some better results if you search for that (with or without an `0x` prefix). – Lance U. Matthews May 30 '19 at 23:34
  • 3
    Roaming (as it's name indicates) is designed to be located on a networked drive if you're using roaming profiles, where the user's profile is available no matter where they log in. Local and LocalLow are designed to be located on the local machine (again, exactly as the names indicate). Why are you trying to move either of them at all? They're no good anywhere except on the local machine. – Ken White May 31 '19 at 00:43
  • you could just try [mklink](https://forums.tomshardware.com/threads/how-do-i-make-a-junction-for-the-appdata-folder.1601645/) but there are [junction points](https://social.technet.microsoft.com/Forums/ie/en-US/49f2a6d6-12db-4d4a-bca8-78642aa15118/application-data-folder-recursion-under-a-junction?forum=smallbusinessserver) inside AppData so it would be worth checking them first. – lloyd May 31 '19 at 00:56
  • 2
    About the status code, you should also know that this is an `HRESULT` code. If the first hex digit (4 bits) is 0x8, it represents an error code. The next 3 hex digits are the facility code, which in this case is Windows (0x007), so we know the last 4 hex digits are a 16-bit Windows error code. These are typically expressed in decimal, so 0x0057 should be searched as 87, which is `ERROR_INVALID_PARAMETER`. Here's the official list of Windows [system error codes](https://learn.microsoft.com/en-us/windows/desktop/Debug/system-error-codes). – Eryk Sun May 31 '19 at 05:02
  • 1
    I believe this question belongs to SuperUser, not StackOverflow. – montonero May 31 '19 at 07:35
  • I want to move them because i have an ssd with very limited storage and they usually take a lot of disk space. – Laikar May 31 '19 at 10:59

0 Answers0