Page 1 of 1

Kill a Task, have a 10 second delay, then restart task

Posted: 09 Feb 2011 11:03
by natechie
Hello,

I have 50 computers that have Virtual PC 2007 (VPC) installed. I need to upgrade VPC to SP1. When I begin the upgrade, I get a little warning like this:

Image

I usually work around the error by starting Task Manager, killing explorer.exe, then click the retry button in the above image and the installation completes. Then, I have to open Task Manager again, then restart explorer.exe.

Obviously the kill/start process of explorer.exe will get quite tedious when upgrading VPC on these computers.

I'm working on a batch script that will kill explorer.exe. Then, I would like there to be a 10 second pause so I can finish the installation of VPC, then the script will automatically restart explorer.exe.

Unfortunately I'm not much of a scripter so I'm getting stuck at the time delay and restarting explorer.

For killing the task I'm thinking of using the simple taskkill /f /im "explorer.exe"

For restarting the task can I just use the simple "start explorer.exe" command?

I don't really need a scripting marvel, just something to the point that works. If someone can help me through a little script together, that would be great. Thanks so much for the help. :D

Re: Kill a Task, have a 10 second delay, then restart task

Posted: 09 Feb 2011 12:07
by aGerman
Hmm, you have TASKKILL and START. What's missing, the 10s delay?

Code: Select all

ping -n 11 127.0.0.1 >nul


Regards
aGerman

Re: Kill a Task, have a 10 second delay, then restart task

Posted: 09 Feb 2011 14:57
by natechie
Thanks for the reply!

Yes, I'm missing the 10s delay.

Re: Kill a Task, have a 10 second delay, then restart task

Posted: 09 Feb 2011 15:14
by aGerman
Well then why don't you merge yours and mine to batch code :?

Code: Select all

@echo off
taskkill /f /im "explorer.exe"
ping -n 11 127.0.0.1 >nul
start explorer.exe

Otherwise you could call your upgrade instead of PING. Is it an exe file? Where is it saved?

Regards
aGerman

Re: Kill a Task, have a 10 second delay, then restart task

Posted: 09 Feb 2011 21:31
by natechie
Sorry, my second reply to this thread wasn't complete and I forgot to come back and update it. :oops:

Thanks for the

Code: Select all

ping -n 11 127.0.0.1 >nul


That was exactly what I needed. I combined the command with taskkill and start and it's running perfectly.

I'm simply saving it as a .bat.

Thanks so much for the help. I really appreciate it. :-)