You can disable programs that start with Windows in MSConfig. If you prefer to kill a process through batch file you can use the taskkill command:
taskkill /f /im processname.exe
Answer from stderr on Stack ExchangeYou can disable programs that start with Windows in MSConfig. If you prefer to kill a process through batch file you can use the taskkill command:
taskkill /f /im processname.exe
In Windows 7, you can use "TASKKILL" which is built in, but you need to know the process ID. You'd get that from the Task manager, by clicking the Processes tab and then using View > Select Columns, and checkmarking PID. Or, you can kill by name.
From the Help file (which you can get to by opening a CMD window and typing "TASKKILL /?") some examples:
TASKKILL /IM notepad.exe
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM cmd.exe /T
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
However, I'm with the other answers -- I can't imagine why you'd want to go through the hassles of killing processes instead of just keeping them from starting in the first place.
You can do this with 'taskkill'. With the /IM parameter, you can specify image names.
Example:
taskkill /im somecorporateprocess.exe
You can also do this to 'force' kill:
Example:
taskkill /f /im somecorporateprocess.exe
Just add one line per process you want to kill, save it as a .bat file, and add in your startup directory. Problem solved!
If this is a legacy system, PsKill will do the same.
taskkill /f /im "devenv.exe"
this will forcibly kill the pid with the exe name "devenv.exe"
equivalent to -9 on the nix'y kill command
How to stop process from .BAT file? - Stack Overflow
Force Kill Bat File STARTS Program
close/kill another Windows process which is started by run a .bat in Qt app
End a Process With a BAT File
Videos
To terminate a process you know the name of, try:
taskkill /IM notepad.exe
This will ask it to close, but it may refuse, offer to "save changes", etc. If you want to forcibly kill it, try:
taskkill /F /IM notepad.exe
As TASKKILL might be unavailable on some Home/basic editions of windows here some alternatives:
TSKILL processName
or
TSKILL PID
Have on mind that processName should not have the .exe suffix and is limited to 18 characters.
Another option is WMIC :
wmic Path win32_process Where "Caption Like 'MyProcess.exe'" Call Terminate
wmic offer even more flexibility than taskkill .With wmic Path win32_process get you can see the available fileds you can filter.
I've given up but I provide this to you for entertainment purposes and the vain hope that maybe some of the mystery gets answered.
I run a dedicated Valheim Server on my Windows 10 computer but I want to shut it off every night at a set time. So I figured I'll set up a bat file to close it for me so I don't have to close it myself. The bat file opens a new instance of command prompt... instead of closing literally anything.
I've tried so many different commands.
@echo off
taskkill /F /PID %valheim_server.exe%
taskkill /F /PID %UnityCrashHandler64.exe%
taskkill /F /PID %conhost.exe%
taskkill /F /PID %cmd.exe%cls
or
taskkill /IM <fullfilepath>
or
taskkill /F /IM <fullfilepath>
or
taskkill /IM <fullfilepath> /F
or
taskkill /IM <fullfilepath> /F
or
taskkill /IM <processname>
or
taskkill /F /IM <processname>
or
taskkill /IM <processname> /F
I've tried just killing the cmd.exe or just killing the valheim_server.exe and both times it STARTS a new instance of cmd.exe, albeit blank with nothing in it. Just the blinky cursor. Running it again just keeps opening more instances. I WANT IT TO CLOSE THINGS, NOT OPEN THEM. Is the internet just trolling me when they said /IM or /F were supposed to close things?
I initially tried just making a scheduled task for my computer to shut itself off but that did absolutely nothing (Edit - I have since fixed that problem). I don't have the brain power to try to figure out exactly what happens when I close the program manually and making a bat file to execute those commands via a .bat file. Those four tasks are listed in the Task Manager in a process group.
I miss Windows XP.
I have this old, old purpose-built piece of software at my job that I'm guessing IT tried to modify so that it would time out if you were inactive too long. But instead of a countdown or a pop-up, it just stops responding after a while, forcing me to open the task manager, force stop, re-launch it, et cetera. In theory it'll sort itself out if you wait, but it's way faster to just kill it.
Is there a way to write a little script or batch file or something that I can keep on my desktop that'll do all that for me with a double click?