Remember, kids, don’t try this at home!

The Makefile for my latest project includes the following:

for pid in `ps -W | grep -iE windows.explorer | awk '{print $$1}'`; 
do /bin/kill -f $$pid; 
sleep 2
cygstart /cygdrive/c/Windows/explorer.exe

5 comments to Remember, kids, don’t try this at home!

  • Why in the world do you need to kill/restart explorer as part of a makefile?

    • I’m developing a toolbar (one of those widgets that sits in the Windows Taskbar). A toolbar is basically a DLL that explorer loads. The DLL exports some standardized symbols which explorer calls. However, there is no way to unload the DLL from explorer.

      So, I have to kill explorer to flush out the old version.

      While it feels evil, it actually works OK. What really annoys me is that I’m going to have to ask users to reboot whenever they upgrade (since killing explorer on end-user systems probably is not acceptable ;))

      • pmb

        You can provide a button that says “I don’t want to reboot, so please kill and restart explorer. I understand that there is a 90% chance this will work, and a 10% chance I will need to reboot anyway”

        • I’m 100% sure it will “work”, but I worry about unintended consequences. Such as system tray icons that don’t reappear even though their process is still running, a failure of Explorer to save any settings due to the ungraceful shutdown, killing any open IE web browsers, file folders, control panel, etc.

          Windows really doesn’t like it when you kill explorer.exe. I’m willing to suffer through it because a debug< ->test cycle that involves a reboot would cripple my development time.

      • However, there is no way to unload the DLL from explorer.

        Are you serious? Why in the world would they design it so that the average user can’t unload certain types of programs without rebooting? That’s just DUMB.

        It certainly does explain why Windows still requires reboots so often, now going into it’s 13th+ year of being an OS. (I’m ignoring that 95/98 were just apps on top of DOS.)

Leave a Reply