bsharath
asked on
Script that checks for processes and stops. Can it stop the processes if any opened.
Hi,
Script that checks for processes and stops. Can it stop the processes if any opened.
Can anyone help changing the script to stop any process thats in the list.
Regards
Sharath
Script that checks for processes and stops. Can it stop the processes if any opened.
Can anyone help changing the script to stop any process thats in the list.
Regards
Sharath
@Echo Off
net stop "Windows Search"
REM Delete Exisitng Temp File
if exist %TEMP%\proc.txt del %TEMP%\proc.txt /q
REM Clear Process Counter
set /a proc=0
\\dev\profilemanager\pslist /accepteula > %TEMP%\proc.txt
Echo Checking for Outlook
find /i "Outlook" %TEMP%\proc.txt
if not errorlevel 1 Set /a proc=%proc%+1
Echo Checking for Communicator
find /i "communicator" %TEMP%\proc.txt
if not errorlevel 1 Set /a proc=%proc%+2
Echo Checking for Desktop Search
find /i "searchindexer" %TEMP%\proc.txt
if not errorlevel 1 Set /a proc=%proc%+3
if %proc%==1 Goto OutlookFound
if %proc%==2 Goto CommFound
if %proc%==3 Goto SearchFound
if %proc%==4 Goto OutlookSearchFound
if %proc%==5 Goto CommSearchFound
if %proc%==6 Goto OutlookCommSearchFound
Echo No Process running
Echo Starting Profile Manager
:PROFMAN
\\dev\profilemanager\profilemgr.exe /logpath=\\dev\profilemanager\logs1
Goto End
:OutlookFound
cls
Echo Outlook is Running. Please Close Outlook before running batch file again.
Pause.
Goto End
:CommFound
cls
Echo Communicator is Running. Please Close Communicator before running batch file again.
Pause.
Goto End
:SearchFound
cls
Echo Desktop Search is Running. Please Close Desktop Search before running batch file again.
Pause.
Goto End
:OutlookSearchFound
cls
Echo Outlook and Desktop Search are Running. Please Close these before running batch file again.
Pause.
Goto End
:CommSearchFound
cls
Echo Communicator and Desktop Search are Running. Please Close these before running batch file again.
Pause.
Goto End
:OutlookCommSearchFound
cls
Echo Outlook, Communicator and Desktop Search are Running. Please Close these before running batch file again.
Pause.
Goto End
:End
del %TEMP%\proc.txt /q
Pause
If it's a service behind the process try "sc stop servicename". To close an applikation, try the command taskkill
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
~bp