Hello, I want to make skin that will kill some process, but I can't find any commands for that.
Example:
I click on the skin and it will kill process firefox.exe
Any ideas??
It is currently October 1st, 2024, 10:15 pm
How do I kill Process?
-
- Posts: 38
- Joined: January 25th, 2013, 10:33 am
- Location: Sweden
-
- Developer
- Posts: 22796
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: How do I kill Process?
The simplest way is to use the Windows taskkill.exe command.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeterOne]
Meter=Image
W=25
H=25
SolidColor=0,0,255,255
LeftMouseUpAction=[Taskkill /IM firefox.exe]
-
- Developer
- Posts: 22796
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: How do I kill Process?
However, it should be noted that that approach will pop a Windows command prompt window for just a second, a bit ugly...
This little example skin contains a tiny AutoIt program that will do the same thing without anything visible when it runs. You can grab the TaskKiller.exe out of it and use it in your skins as you like.
AutoIt code:
Rainmeter Skin:
This little example skin contains a tiny AutoIt program that will do the same thing without anything visible when it runs. You can grab the TaskKiller.exe out of it and use it in your skins as you like.
AutoIt code:
Code: Select all
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
If $CmdLine[0] = 1 Then
$Proc = $CmdLine[1]
Else
Exit
EndIf
While ProcessExists($Proc)
ProcessClose($Proc)
WEnd
Exit
Code: Select all
[Rainmeter]
Update=1000
[Variables]
Proc="Notepad.exe"
[MeterOne]
Meter=Image
W=25
H=25
SolidColor=136,209,140,255
LeftMouseUpAction=["#@#Addons\TaskKiller.exe" #Proc#]
You do not have the required permissions to view the files attached to this post.
-
- Posts: 38
- Joined: January 25th, 2013, 10:33 am
- Location: Sweden
Re: How do I kill Process?
jsmorley wrote:However, it should be noted that that approach will pop a Windows command prompt window for just a second, a bit ugly...
This little example skin contains a tiny AutoIt program that will do the same thing without anything visible when it runs. You can grab the TaskKiller.exe out of it and use it in your skins as you like.
AutoIt code:
Rainmeter Skin:Code: Select all
#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If $CmdLine[0] = 1 Then $Proc = $CmdLine[1] Else Exit EndIf While ProcessExists($Proc) ProcessClose($Proc) WEnd Exit
Code: Select all
[Rainmeter] Update=1000 [Variables] Proc="Notepad.exe" [MeterOne] Meter=Image W=25 H=25 SolidColor=136,209,140,255 LeftMouseUpAction=["#@#Addons\TaskKiller.exe" #Proc#]
Thanks, but how do I do if I want it to kill more than one??
-
- Posts: 38
- Joined: January 25th, 2013, 10:33 am
- Location: Sweden
Re: How do I kill Process?
Thanks for the help, I figured it out how to kill more than one process, thanks anywayjsmorley wrote:However, it should be noted that that approach will pop a Windows command prompt window for just a second, a bit ugly...
This little example skin contains a tiny AutoIt program that will do the same thing without anything visible when it runs. You can grab the TaskKiller.exe out of it and use it in your skins as you like.
AutoIt code:
Rainmeter Skin:Code: Select all
#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If $CmdLine[0] = 1 Then $Proc = $CmdLine[1] Else Exit EndIf While ProcessExists($Proc) ProcessClose($Proc) WEnd Exit
Code: Select all
[Rainmeter] Update=1000 [Variables] Proc="Notepad.exe" [MeterOne] Meter=Image W=25 H=25 SolidColor=136,209,140,255 LeftMouseUpAction=["#@#Addons\TaskKiller.exe" #Proc#]
-
- Developer
- Posts: 22796
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: How do I kill Process?
Glad to help. You can use my little utility to kill more than one with something like:
LeftMouseUpAction=["#@#Addons\TaskKiller.exe" Notepad.exe]["#@#Addons\TaskKiller.exe" Firefox.exe]["#@#Addons\TaskKiller.exe" Calc.exe]
LeftMouseUpAction=["#@#Addons\TaskKiller.exe" Notepad.exe]["#@#Addons\TaskKiller.exe" Firefox.exe]["#@#Addons\TaskKiller.exe" Calc.exe]
-
- Developer
- Posts: 22796
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: How do I kill Process?
UPDATE
I actually don't recommend using the little AutoIt addon I included in this thread anymore. The only advantage it had was that it didn't pop up a cmd window when executed, but the disadvantage it has is that it will terminate with extreme prejudice the process in question, which may not be what you want.
I recommend instead that you use the taskkill.exe utility that comes baked-into Windows.
You can use the RunCommand plugin to execute the utility without popping up any cmd window.
taskkill.exe has two basic forms:
1) With /F as a parameter, it will "force" the process to close, in effect it will "kill" the process without giving it any opportunity to do any kind of cleanup or ask "are you sure?" and such.
2) Without /F as a parameter, a signal to "close" will be sent to the process, and the process itself will take care of shutting down. This will allow the process to prompt you to save open documents and the like, and is in general a lot more "gentle" a way to close a program.
KIll: SUCCESS: The process "notepad.exe" with PID 11008 has been terminated.
Close: SUCCESS: Sent termination signal to the process "notepad.exe" with PID 17768.
So If you open Notepad.exe and type some characters in it, using "Close" will NOT close the program right away, as it will prompt you to save or discard the changes you have made. Using "Kill" will just nuke the program, and all changes you made will just be lost.
How you use this utility is up to you, and should be based on whether you want to assuredly and silently kill the program, which is generally is fine, or want it to just tell the program to close itself, which might be a better fit with some programs. There could be some "cleanup" or "saving of a state" that a program does when it is gracefully closed, that you might want.
Someone had mentioned that if you "kill" Google Chrome for instance, when it is started back up, it acts as though it had "crashed" before, and will complain some. Using the "close" variant of taskkill.exe is probably a better idea for that case.
I actually don't recommend using the little AutoIt addon I included in this thread anymore. The only advantage it had was that it didn't pop up a cmd window when executed, but the disadvantage it has is that it will terminate with extreme prejudice the process in question, which may not be what you want.
I recommend instead that you use the taskkill.exe utility that comes baked-into Windows.
Code: Select all
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Description:
This tool is used to terminate tasks by process id (PID) or image name.
Parameter List:
/S system Specifies the remote system to connect to.
/U [domain\]user Specifies the user context under which the
command should execute.
/P [password] Specifies the password for the given user
context. Prompts for input if omitted.
/FI filter Applies a filter to select a set of tasks.
Allows "*" to be used. ex. imagename eq acme*
/PID processid Specifies the PID of the process to be terminated.
Use TaskList to get the PID.
/IM imagename Specifies the image name of the process
to be terminated. Wildcard '*' can be used
to specify all tasks or image names.
/T Terminates the specified process and any
child processes which were started by it.
/F Specifies to forcefully terminate the process(es).
/? Displays this help message.
Filters:
Filter Name Valid Operators Valid Value(s)
----------- --------------- -------------------------
STATUS eq, ne RUNNING |
NOT RESPONDING | UNKNOWN
IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh - hours,
mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
format
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title
NOTE
----
1) Wildcard '*' for /IM switch is accepted only when a filter is applied.
2) Termination of remote processes will always be done forcefully (/F).
3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote
machine is specified.
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*"
You can use the RunCommand plugin to execute the utility without popping up any cmd window.
taskkill.exe has two basic forms:
1) With /F as a parameter, it will "force" the process to close, in effect it will "kill" the process without giving it any opportunity to do any kind of cleanup or ask "are you sure?" and such.
2) Without /F as a parameter, a signal to "close" will be sent to the process, and the process itself will take care of shutting down. This will allow the process to prompt you to save open documents and the like, and is in general a lot more "gentle" a way to close a program.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
[MeasureKill]
Measure=Plugin
Plugin=RunCommand
Parameter=taskkill /F /IM notepad.exe
State=Hide
OutputType=ANSI
[MeasureClose]
Measure=Plugin
Plugin=RunCommand
Parameter=taskkill /IM notepad.exe
State=Hide
OutputType=ANSI
[MeterKillNotepad]
Meter=String
FontSize=12
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Kill Notepad
LeftMouseUpAction=[!CommandMeasure MeasureKill "Run"]
[MeterCloseNotepad]
Meter=String
X=5R
FontSize=12
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Close Notepad
LeftMouseUpAction=[!CommandMeasure MeasureClose "Run"]
Close: SUCCESS: Sent termination signal to the process "notepad.exe" with PID 17768.
So If you open Notepad.exe and type some characters in it, using "Close" will NOT close the program right away, as it will prompt you to save or discard the changes you have made. Using "Kill" will just nuke the program, and all changes you made will just be lost.
How you use this utility is up to you, and should be based on whether you want to assuredly and silently kill the program, which is generally is fine, or want it to just tell the program to close itself, which might be a better fit with some programs. There could be some "cleanup" or "saving of a state" that a program does when it is gracefully closed, that you might want.
Someone had mentioned that if you "kill" Google Chrome for instance, when it is started back up, it acts as though it had "crashed" before, and will complain some. Using the "close" variant of taskkill.exe is probably a better idea for that case.
-
- Rainmeter Sage
- Posts: 8296
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: How do I kill Process?
Huh. I had no idea this was your addon in a related thread, I thought it was a mobile app - must have been the similarity of names. Sorry for not realizing it, and yep, RunCommand + taskkill will kill the app silently when using the /F parameter on the latter.
-
- Posts: 64
- Joined: March 24th, 2019, 5:52 pm
Re: How do I kill Process?
Thank you very much, this helped me a lot!
-
- Posts: 64
- Joined: March 24th, 2019, 5:52 pm
Re: How do I kill Process?
Ehy again xD now i get that you didn't get back in my topic, because i didn't get what did you mean with mobile app there xDYincognito wrote: ↑October 30th, 2020, 12:23 pm Huh. I had no idea this was your addon in a related thread, I thought it was a mobile app - must have been the similarity of names. Sorry for not realizing it, and yep, RunCommand + taskkill will kill the app silently when using the /F parameter on the latter.