I've got questions about moving files via IntControl 30. The help file states that is will return "2" if it performed a regular FileMove. From that a presumed two things (note: I did not "assume". I "presumed" because...well, you know):
First that a 'regular FileMove' meant that it would take place then and there. Is that correct?
Second, that it would perform this 'regular' FileMove, if a delayed move was not necessary. Like if the file was not in use. This is not what I'm experiencing.
It seems that my script is performing a delayed move, regardless of the state of my target file. How does this crazy thing work?
The purpose of IntControl 30 is to perform a delayed file move. Meaning that the indicated file will not be moved or deleted until the system is rebooted. The function returns 1 when the delayed move is setup for the next reboot. If the delayed move cannot be setup, the function will attempt to perform an immediate file moving using the WIL FileMove function's implementation. This is why the function name FileMove is colorized and underlined as a link in the help file documentation for the IntControl. When the IntControl successfully completes the immediate file move using FileMove's implementation, it returns 2.
The immediate file move may occur because you are attempting to use IntControl 30 from a NON elevated admin or standard user account although there are other possible reasons for this.
Thank you. "If the delayed move cannot be setup, the function will attempt to perform an immediate file moving using the WIL FileMove function's implementation" was what I didn't understand. I was guessing (again, not assuming) that it worked the other way - it would do an immediate move if it could. Maybe it was hoping more than guessing.
Who am I kidding. Those were assumptions all the way.
The IntControl's purpose is to perform delayed file moves and deletions. The reason it has the immediate move fallback is a legacy from very old versions of Windows that did not support the functionality. The idea is to call the IntControl when the FileMove function fails in installation scripts and the like.