Moving .platformio directory to another drive

I’d like to move the .platformio directory to another drive.
I am running Windows 10 and using PlatformUI Core 5 within Visual Studio Code.

I have tried to set the environment variable PLATFORMIO_CORE_DIR to the new location of the directory and renamed the original directory to verify that it’s correctly working.
Unfortunately when I open my project the compiler complains that it can’t find the configuration and the compile path and tries to use a different one. I have also tried to set the core_dir variable in platformio.ini, but also to no avail.

However when I renamed the directory at the original location to “.platformio” again and retried, it worked as supposed - but when compiling the project it executed the task from the new location.

“Executing task in folder GarageControlUnit: d:\PlatformIO.platformio\penv\Scripts\platformio.exe run <”

So it seems I have to set more than just “PLATFORMIO_CORE_DIR”. I also tried PLATFORMIO_PACKAGES_DIR and PLATFORMIO_PLATFORMS_DIR, but had no success.

Which environment variables do I have to set in order to get rid of the folder “.platformio” in the user home directory?

Thanks for your help,


Have you tried to build the project once regardless? Maybe the files get moved during the first build process and you have to keep the files in their original place until that.

No, I had’nt tried that. Now, after you mentioned it, I gave it a try and it worked.
That seems a bit strange to me, because I get the following two messages:

[11.3.2021, 16:17:35] Die Konfiguration mit compilerPath “C:/Users/Rudolf/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc.exe” kann nicht aufgelöst werden. Stattdessen wird “D:\MinGW\bin\gcc.exe” verwendet.
[11.3.2021, 16:17:35] Die Konfiguration mit compilerPath “C:/Users/Rudolf/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc.exe” kann nicht aufgelöst werden. Stattdessen wird “D:\MinGW\bin\gcc.exe” verwendet.

However, as mentioned if I do a compile it compiles ok, but it gave me 169 warnings about my include path. I had to correct all corresponding pathes in the file “c_cpp_properties.json” and now it works like a charm. No compile error, no compile warning;-)

Thanks for your help!


Seems like an old path. Try and force a IntelliSense rebuild by Ctrl+Shift+P -> Rebuild IntelliSense.

Double check that the “compilerPath” option in the .vscode/c_cpp_properties.json file is updated then, too.

Everything’s fine now - as I mentioned in my post before I did already change all entries with my old path to the new path - since I did a “Replace all” the compilerPath option was already updated.

Everythings ok now - thanks for you help.