Tessler's Nifty Tools includes WrapUp. Just as Windows executes all programs in its StartUp folder when it is first starting up, WrapUp automatically executes all programs in its ShutDown folder or LogOff folder right before Windows exits or logs off. WrapUp is not a scripting program. It only executes your programs. Your own programs must either have command line options or built-in scripting to direct it to perform the actions that you want. If your program does not have one of these features, consider purchasing any one of several script/batch tools for Windows, create a script to command your program to do whatever you want, and lastly place the script into your ShutDown or LogOff folder for WrapUp to execute.
WrapUp's shutdown behavior is highly configurable: When WrapUp detects that you have issued a command to exit Windows, its default behavior is to ask you if you want to terminate all currently executing programs and then execute all programs in WrapUp's ShutDown folder. Once you are done working with the ShutDown folder's programs, you issue another shut down command. This time Windows will exit since WrapUp has already executed its programs.
If you choose, you can always have WrapUp terminate all currently executing programs and execute the ShutDown folder's programs without asking you for permission.
If you choose, rather than having WrapUp terminate all your existing programs, you can specify that WrapUp should let all existing programs continue to execute, and simply execute the ShutDown folder's programs. You can also have WrapUp terminate all programs except for programs that you specify.
If you don't want to have to issue a second shut down command, you can configure WrapUp to detect when all of its ShutDown folder's programs have terminated and then automatically exit or restart Windows. You can configure WrapUp to execute invisibly so that the user never knows that it is executing on his/her PC.
According to the vendor's site, a single user license is $39 and a maintance cost is $19.