Earlier, I wanted utilize robocopy to synchronize my local caches of the Systinternals' tools from file://live.sysinternals.com/. I maintain two copies: one on my OS drive and one on my thumb drive. My purpose for this is is that I want these tools immediately available when I want to run them -- and while the live share is nice, it takes a few seconds to load.
So I wrote a simple batch script; and made a rudimentary scripting mistake: I wrote a batch script titled robocopy.bat and attempted to call the robocopy executable without specifying it's full path. Here is my original script:
So, this mistake led to some Windows Command Processor crashes:
Interesting right? The infinite loop caused CMD.exe to crash (I guess it's time to install PowerShell and actually read those powershell books on my bookshelf.) When CMD crashed, I went to edit the batch script but wasn't able to save modifications:
OK. I figured that cmd.exe had a lock on the handle -- and I remembered that OpenedFilesView wouldn't work in Vista x64, I didn't feel like downloading a utility and I certainly didn't feel like logging out.
Somehow, I ended up searching for the file handle with Process Explorer's handle or DLL search feature.
After closing the handle, I was able to save modifications to the batch script.
Finally, I fixed my script to call the robocopy executable by it's absolute full path:
C:\Windows\System32\Robocopy.exe
I'm glad I learned about the file handle search feature in Process Explorer -- this utility is incredible. Thanks Sysinternals.
No comments:
Post a Comment