Stop postgres.exe background processes - windows

How do I stop these background processes? I already stopped postgresql-x64-14 service and disconnected from all databases. Clicking "end task" doesn't help since they restart on their own.

One possible solution would be to stops the postgres.exe background processes using the following code:
Taskkill /FI "IMAGENAME eq postgres.exe" /T

Related

How can I stop one instance via cmd of a process when several are running?

I start a program from a scilab script via the command line, start myprog.exe.
After the start my scilab script needs to keep going.
Now I want to stop exactly this instance of the process via the command line too, even if several instances of the same program are running.
Is that possible?
I know how to query via batch files whether a process of this program is running and then stop it, but I don't know how to get the exact allocation.
Is there something like a process id?
I use this to check if the process is running:
tasklist /fi "imagename eq ccx.exe" |find ":" > nul
if errorlevel 1 echo Program is running
if not errorlevel 1 echo Program is not running
Use the command tasklist to view all running tasks with their PID
then
Taskkill /PID 26356 /F
or
Taskkill /IM myprog.exe /F

Need help using tasklist to check if the Battle.net process

I am trying to create a batch file as an impromptu shortcut to launch the Battle.net client and when it fully opens, to launch Hearthstone specifically but i'm sure it can be applied to any Blizzard game.
The problem is when I run
start "" "C:\Program Files (x86)\Hearthstone\Hearthstone Beta Launcher.exe"
tasklist /fi "IMAGENAME eq battle.net.exe" 2>NUL | find /I /N "battle.net.exe">NUL
if "%ERRORLEVEL%"=="0" echo Battle net is ready
And if that worked then I would use start "" "battlenet://WTCG" but it immediately echos even though nothing is visible on my screen and the process is not running in task manager. Which means it would try to launch hearthstone without Battle.net being open even though the script says it is.
Is this just an issue with Battle.net processes or am I doing something very wrong? I am currently using Windows 10 if it matters.

windows task scheduler: how trigger task then program has closed?

I'm building a specific task.
I need to track when a program ends, make report and analyze it. So, I want to create a schedule for it.
For example, I have process called testing.exe, and I want to check for it's log after it finishes job. I have analyze.bat file. I just need something to run it, just after testing.exe finishes it's job and closes.
I can't change anything in program code, so I believe, that task scheduler is the only way.
Help me please
Task Scheduler is not even required for this! It can be done under just batch!
#echo off
set batdir=____________
:begin
tasklist /FI "IMAGENAME eq testing.exe" 2>NUL | find /I /N "testing.exe">NUL
if "%ERRORLEVEL%"=="0" goto start
goto begin
:start
tasklist /FI "IMAGENAME eq testing.exe" 2>NUL | find /I /N "testing.exe">NUL
if "%ERRORLEVEL%"=="0" goto start
start %batdir%\analyze.bat
Just replace _________ with the directory of analyze.bat and it should work. What it does is: it first waits for testing.exe to start. If it started or was already on, it switches and now waits for testing.exe to close. Once it closes, it starts analyze.bat which is exactly what you wanted without the need of Task Scheduler. Hope I helped!

How can I end all unneccesary processes except cmd.exe?

I am trying to end all processes except cmd.exe, so that the script can remove files without any processes interfering. I have tried using
taskkill /f /fi "IMAGENAME ne cmd.exe"
but this doesn't work. As expected it kills all processes but it still ends up killing cmd.exe. Is this because it is killing a process that keeps windows open? What am I doing wrong?
End all processes except for these:
spoolsv.exe
lsass.exe
csrss.exe
smss.exe
winlogon.exe
svchost.exe
services.exe
conhost.exe
cmd.exe
Nothing as far as I can see - but if your goal is indeed to prevent unauthorised use, why not simply execute shutdown ? - see shutdown /? from the prompt for options.

Shutting down a windows process from Mathematica

One can see there are list of process running in a Windows operating system just by opening the task manager. Now my question is if it is possible to shut down one such process from Mathematica front end.
I mean we need to write a script say to kill the "Process Tree" if the process is taking more than 95 percent of system RAM or it takes more than X minutes or seconds to complete. I dont know if that can be done from MMA but if possible it will come really handy in my project.
BR
I used a method to shut down a process in my reply here:
How can I make Mathematica kernel pause for an external file creation
taskkill /f /fi "imagename eq apame_win64.exe"
E.g. shutting down notepad:
ReadList["!taskkill /F /FI \"IMAGENAME eq notepad.exe\"", String]
This can be used in conjunction with tasklist to identify memory use:
ReadList["!tasklist", String]
You will probably want to use the Run function, and the TSKILL shell command.
TSKILL processid | processname [/SERVER:servername] [/ID:sessionid | /A] [/V]
processid Process ID for the process to be terminated.
processname Process name to be terminated.
/SERVER:servername Server containing processID (default is current).
/ID or /A must be specified when using processname
and /SERVER
/ID:sessionid End process running under the specified session.
/A End process running under ALL sessions.
/V Display information about actions being performed.

Resources