Link to home
Start Free TrialLog in
Avatar of computerlarry
computerlarryFlag for United States of America

asked on

Is there any way to create a simple app on windows 7 that will end a process in Task manager?

The user still has windows 7, and are running it with Outlook from Office 365.   Every so often, Outlook won't start up.  If I go to the task manager and end the Outlook process, Outlook will start up fine.

Is there any simple app that can be created that will do this process for the user?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of computerlarry

ASKER

Can I add a line to start Outlook to the batch?

just add the following to the new line at the end of your batch.
if your running 32 bit office use(x86) or if your using 64 delete the "(x86)" out
Also depending on your version of office the "Office17" may be "Office15" for office 2013 or "Office16" for office 2016. 
start "" "%ProgramFiles(x86)%\Microsoft Office\Office17\outlook.exe"

Open in new window

Avatar of oBdA
oBdA

This should find Outlook automatically:
@echo off
setlocal
taskkill.exe /FI "USERNAME eq %UserName%" /FI "IMAGENAME eq outlook.exe" /F
for /f "tokens=2 delims=/=" %%a in ('ftype outlookfeed') do set Outlook=%%a
if not defined Outlook (
	echo No Outlook installation found!
	exit /b 1
)
echo Starting Outlook: %Outlook%
start "" %Outlook%

Open in new window

1) @oBdA provided the answer.

You'll use command line taskkill command, rather than a GUI tool like Task Manager.

2) You asked, "Can I add a line to start Outlook to the batch?"

This is a very bad idea.

Imagine the scenario of Outlook crashing, this will create a loop of Outlook start -> Outlook crash -> Repeat.

If the machine has a fast CPU + lots of memory, likely this type of loop will just be annyoing.

On a low resource machine... running Windows 7... this could potentially create a situation where the machine would lock up (no interactivity) because of the start/crash churn.
This is a manually started script, it's not running in a loop (unless the user keeps clicking on it ...)
I decided to just create a cmd file with only the task kill.

The user was more comfortable starting Outlook the normal way after running the cmd file.

Thanks!