I'm trying to edit a json file which is located inside a folder in AppData\Roaming
.
The file path is AppData\Roaming\Myapp\RANDOM_CRAP\settings.json
RANDOM_CRAP
is just a random folder name which is different for every machine.
In order to open this file for writing, I first tried to get it's file path, like so:
function getAppData() {
var oShell = new ActiveXObject("WScript.Shell");
var strValue = oShell.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders\\AppData");
return strValue;
}
Problem is, the value stored under that registry key is %USERPROFILE%\AppData\Roaming
which doesn't seem to open with:
var folder = fso.GetFolder(getAppData());
(Throws Path not found
error)
Can I get to the APPDATA path in another way?