Reputation: 21
I've had no luck researching what I assume is a very simple issue - there are suggestions here via search but they did not resolve it for me
Advanced apologies if I have missed what has been faq'd/posted elsewhere - must state that beyond insanely simple code, mostly copied and pasted in, I've never written .bat files before
I'm writing a small .bat for sccm to run:
Making my way through it, I got to step two, running the cleanup tool successfully after the uninstall - so getting rid of the old program with my .bat works 100% fine.
The issue with the uninstall and the cleanup tool is when run silently they do not prompt options - one of which states the program needs to kill explorer.exe
Ignoring potential solutions to prevent it closing explorer.exe; I thought oh well no big deal, a cmd command "explorer.exe" boots explorer back up fine, I'll just throw that in my batch file
msiexec /x {APPID HERE} /qn /norestart
"%~dp0Remover.exe" /qn /norestart
explorer.exe
But it doesn't work - the uninstall/cleanup runs and I (and therefore any user) will be sat there with a blank "explorer-less" screen.
So I thoght ok I'll be specific
msiexec /x {APPID HERE} /qn /norestart
"%~dp0Remover.exe" /qn /norestart
**%windir%\**explorer.exe
Nope, same issue
I checked task manager and there seemed to still be an explorer task despite the blank screen - ok maybe I need to use more of an explorer restart than just launch it
msiexec /x {APPID HERE} /qn /norestart
"%~dp0Remover.exe" /qn /norestart
taskkill /f /IM explorer.exe
%windir%\explorer.exe
No dice
I've tried throwing in sleep in there to give it a sec after uninstalling the apps (no idea if this would help - didn't solve it anyway) I've tried adding "Start" (Start %windir%\explorer.exe) - tna
I'm guessing you guys are going to say something like "dude, hit tab before line 3" or something painfully simple like that but... I've not managed to find the solution through a fair few google clicks and forum searches.
I've killed explorer manually and ran a batch file that just contains %windir%\explorer.exe and it makes explorer spring back to life... so why doesn't it action the same command after completing the two lines above it?
Thanks a lot
edit Cheers tripehound
so this would read
start /wait msiexec /x {appID} /qn /norestart
start /wait "" "%~dp0Cleaner.exe" /qn /norestart
start /wait msiexec /i "%~dp0MSI.msi" /qn REBOOT=ReallySuppress
start /wait msiexec /i "%~dp0MSI2.msi" /q REBOOT=ReallySuppress
taskkill /f /IM explorer.exe
%windir%\explorer.exe
Right? - the double quotes only for the cleaner as it is a .exe? Although the MSI presumably have the gui
Upvotes: 2
Views: 559
Reputation: 21
Thanks for your help Tripehound - I'm sure I needed the addition of start /wait anyway but it turns out my issue was due to the fact I was running CMD "as" my admin account (we log in with base accounts and use our admin credentials to elevate)
So my cmd was essentially running the start /explorer under my admin account and I therefore didn't get explorer.exe back on my logged in base account
Now to go down the whole other path of.. how do I get the batch file (or call another file) which would run explorer as the current user sigh
Upvotes: 0