Taskkill.exe is not shutting down Outlook.exe

Got a problem you cannot solve? Try here.
ezG
Posts: 8
Joined: Thu Sep 03, 2020 1:03 am

Taskkill.exe is not shutting down Outlook.exe

Postby ezG » Sat Sep 26, 2020 12:16 am

We have COM Add-Ins that need to be updated, but they require that Outlook be closed before unregistering them.

TaskKill.exe ONLY works when it is called after "Apply Install" has been run. I'm still new to this software. Why is this the case?

Would I run into problems if I called "Apply Install" before having installed anything, just so I an run taskkill.exe?

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Taskkill.exe is not shutting down Outlook.exe

Postby FrancescoT » Mon Sep 28, 2020 11:35 am

I suppose you are executing "taskkill.exe" via "Run Program" command, and "Run Program" can be invoked at any time during the script (regardless of Apply install execution).

Can you share more details on this?

Btw, you may also use "Terminate Process -command" to shutdown of a running application.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

ezG
Posts: 8
Joined: Thu Sep 03, 2020 1:03 am

Re: Taskkill.exe is not shutting down Outlook.exe

Postby ezG » Tue Sep 29, 2020 3:02 am

Here is a code snippet

DOES NOT WORK HERE
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable REMOVEOLD to
Set Variable ERROROLD to
Run Program $WINSYSDIR$\taskkill.exe /F /IM outlook.exe (WAIT, get result into variable SUCCESS)
Run Program $TARGETDIR$\adxregistrator.exe /uninstall="myAddIN.dll" (WAIT)
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)


WORKS HERE
[compiler if Variable BUILDMODE Equals PATCH]
Apply Patch (get result into variable SUCCESS)
[compiler else]
if Variable ADVERTISE Equals TRUE
Apply Advertised (get result into variable SUCCESS)
else
Apply Install (get result into variable SUCCESS)
end
[compiler end]
Run Program $WINSYSDIR$\taskkill.exe /F /IM outlook.exe (WAIT, get result into variable SUCCESS)
Run Program $TARGETDIR$\adxregistrator.exe /install="myAddIn.dll" (WAIT, get result into variable InstallStatus)
if Variable OutlookVersion Equals Outlook.Application.15

ezG
Posts: 8
Joined: Thu Sep 03, 2020 1:03 am

Re: Taskkill.exe is not shutting down Outlook.exe

Postby ezG » Tue Sep 29, 2020 3:54 am

Your answer led me to the solution.

When you said that the command could be run at any time, I took a look at the code again.

I noticed the variable $WINSYSDIR$. When I removed it from the command line, it worked!

Run Program taskkill.exe /F /IM outlook.exe (WAIT, get result into variable SUCCESS)

Apparently $WINSYSDIR$ doesn't have a value, or the wrong one when it was run so early in the code. Near the end of the code, it has a value; hence $WINSYSDIR$\Taskkill.exe works at that point.

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Taskkill.exe is not shutting down Outlook.exe

Postby FrancescoT » Tue Sep 29, 2020 5:09 am

I think you caught the problem!

Typically, WINSYSDIR gets defined within the [Define Setup Globals] block of the script.
Obviously any attempt to use such variable prior the above assignment returns an EMPTY value.

You can just specify "taskkill.exe" (without path) with Run Program, or alternatively, you may initialize WINSYSDIR earlier in your code ...both approaches should work identically.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 118 guests