[SOLVED] [SOLVED] BAT and AHK scripts losing access to "documents" folder?

Status
Not open for further replies.

vertigoelectric

Distinguished
Apr 2, 2013
62
0
18,630
TLDR: This problem was caused by Avast AV blocking my scripts.

This is an incredibly frustrating issue, and I need help. I have various Batch and AutoHotkey scripts that do different things with files. A few weeks ago, I had an issue where suddenly these scripts stopped working and I determined it was due to them losing write access to my documents folder. I tried many things, such as taking ownership, changing security settings, and more. Unfortunately, I ended up just creating a new documents folder and moving everything. That worked for a while.

Just before that happened, I had installed a cracked program that I was already suspicious about and figure that was the blame. I uninstalled it, ran AV software, and did other cleaning.

Now it has happened again. This time I don't even know what to blame it on. I don't want to have to keep moving everything to a new folder. I need to solve this problem for good. Any help is greatly appreciated.

I have no problems creating, modifying, copying/moving files in/out of the documents folders or its subfolders. Other software can also do this. For some reason it's just the custom scripts I create.

Here's an example.

I create test.bat:

dir > something.txt
pause


What this should do is create the file "something.txt" in the folder. However, when I double click it to run it, I get "Access is denied." in the command prompt window.

If I open up a command prompt window first (does not have to be admin elevated, either), and then type "dir > something.txt" and press enter, the file is created successfully. Also, if I type "test.bat" in the already-open command window, it will run and create the file successfully.

Again, I've tried taking ownership of the folder, I've tried setting permissions, and I've even tried "restoring default permissions" using a 3rd party utility (Tweaking.com Windows Repair).

I have no idea what to do next. For now I might just go ahead and move everything again, and perhaps someone here can help me prevent it from happening in the future.
 
Last edited:
Solution
I'm an idiot. Sigh. It was the effing Avast AV blocking my scripts from modifying the files. This never occurred to me before because it seemed to happen out of nowhere, and I've no idea why it only now decided to start blocking. Still, I should have considered it earlier. I'll leave this here just in case anyone else can learn from my ridiculousness.

vertigoelectric

Distinguished
Apr 2, 2013
62
0
18,630
I'm an idiot. Sigh. It was the effing Avast AV blocking my scripts from modifying the files. This never occurred to me before because it seemed to happen out of nowhere, and I've no idea why it only now decided to start blocking. Still, I should have considered it earlier. I'll leave this here just in case anyone else can learn from my ridiculousness.
 
Solution
Status
Not open for further replies.