Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

FileCopy fails

$
0
0

Hi, I'm having a problem with my script. It intends to replace "aero.msstyles" in my fresh install of Windows 7. First I give it permissions to do so - it works, I have permissions. Then I close explorer.exe to make sure file is not in use. And then FileCopy fails...

And the strangest thing that if I run the same FileCopy command as a standalone script, it works (provided permissions are already given and explorer isn't using the file). I can't understand why would it work as a separate script, but would always fail in my script.  :mad2:

#notrayicon #RequireAdmin #include <Permissions.au3> _GrantAllAccess(@WindowsDir & '\Resources\Themes\Aero\aero.msstyles') ProcessClose('explorer.exe') ProcessWaitClose('explorer.exe') FileCopy(@ScriptDir & '\aero.msstyles', @WindowsDir & '\Resources\Themes\Aero\aero.msstyles', 1) ShellExecute('explorer.exe')

P.S. I have also tried launching explorer.exe and copying file after that, but still nothing. Besides, as far as I'm aware file copying should not depend on Windows Explorer.

And yes, copy fails even when original file doesn't exist in the directory (i.e. script does not fail trying to replace).

 

 

UPDATE:

 

Deleted all explorer.exe-related lines, and now it works. But it's no good for me because I do need to restart explorer to prevent "file in use".

Does... uhm... does restarting Windows Explorer intervene with the script somehow?

 

 

UPDATE 2:

 

Also it looks like the script hangs for some unknown reason. That's even more weird because I don't see what could potentially hang it.


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>