I have the following function that counts size of folder, for some reason, I get path not found an error in this function, yet I am pretty sure that path is correct and I have escaped slashes correctly.
function ShowFolderSize(filespec3)
{
var fso3, f3, s3;
fso3 = new ActiveXObject("Scripting.FileSystemObject");
f3 = fso3.GetFolder(filespec3);
s3 = f3.Name + " uses " + f3.size + " bytes.";
return(s3);
}
ShowFolderSize("%userprofile%\\AppData\\Local\\Temp");
Is there something wrong with %userprofile%?
Using this function inside the HTA app is blocked by various antivirus software, they don't give you permission to check file size or do other operations associated with it.
The only solution which I found, in this case, is to pass variables to an external batch file and execute it, in this case, antivirus won't block it. For some reason, they trust batch files, but they block HTa applications from accessing files.