I have an interesting issue that seems to only occur on Windows 7 machines. I wrote an application that manages SQL installs for our company, basically it can install, uninstall, reinstall, or upgrade our instance of SQL on XP, NT, 2003, vista, 2008, and Win 7 machines using either MSDE or SQL 2005. It also has some backup and restore options for the database files themselves.
All of that works really well, the issue that I have is that I have the application minimize all windows and kill explorer.exe so that other applications shouldn't interfere with the program and so that the end customer, (that's who this is designed for) is unable to start any other apps or do anything else on the machine until the application is finished because it can cause other issues.
Now on all machines the closing of explorer.exe works great and on all machines but 7, when I call explorer.exe, the shell reloads; however, on Win 7, calling explorer just opens an explorer window, it does not reload the shell and I cannot figure out why.
Does anyone have any experience with this or any ideas on how I could call explorer to reload as a shell properly on Win 7?
Here is the code I use to end explorer.exe:
Code:
Runwait, %comspec% /c "taskkill /IM explorer.exe /F" ,,Hide ;Closes explorer.exe to prevent conflicts with running applications and stop users from trying to run other things while the utility is running, explorer will be restored automatically once the program is finished
Runwait, Pskill.exe explorer.exe,,Hide ;Redundant, called a couple of times using an alternative method to make sure that all explorer windows and the shell are closed and antivirus/firewalls didnt't block the previous method
Runwait, Pskill.exe explorer.exe,,Hide
ExplorerClosed = 1
I have tried the following for reloading the shell:
Code:
Run, %comspec% /c "%A_homedrive%\alasql\Restart Shell.bat" ,,Hide
Code:
Run, %comspec% /c "%A_windir%\explorer.exe" ,,Hide
Code:
Run, %comspec% /c "Start explorer" ,,Hide
The code for the above bat file:
Code:
@echo OFF
CLS
PING 127.0.0.1 -n 8 >NUL
taskkill /f /im explorer.exe
start explorer.exe
Any help is appreciated