I have a script that's working wonderfully until it tries to delete the temporary files it creates, then I get a Permission Denied error message.
The command is simply:
fso.DeleteFile(tempWAVPath)
Where fso
is ActiveXObject("Scripting.FileSystemObject")
and tempWAVPath
is: C:\Users\XXX\AppData\Local\Temp\RandomTempName\TemporaryFile
Considering the script created both the folder and the file, I'm perplexed as to why it's getting a Permission denied error.
The script is being run via an Admin CMD and cscript
Anyone have any idea why?
Ah! The file was ReadOnly. Fixed it by adding the following:
file = fso.GetFile(tempWAVPath)
if(file.attributes & 1) {
file.attributes = file.attributes - 1
}