It is currently April 25th, 2024, 1:57 am

Kill Process with RunCOmmand or PSRM questions

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

Hello,
I have been having problems with razer synapse3 dropping out or losing functionality of a device. Ending the process then restarting does the trick but it is cumbersome to do when playing.

I am hoping to use taskkill but if there is a better command, I'd appreciate any help.

So far I have been trying to do it right on the command line, but I am having no real progress.

TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM Razer Synapse 3.exe

That doesn't work, but killing the process forcefully seems fastest since I am just exiting all apps with the tray icon, so that seems the logical choice - or not... I am not really clear on the syntax at all.

Any and all help is appreciated. ALso how would the command look like in RunCOmmand or PSRM?

Thanks for any help.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

OOH OOh ooh.

I just think I got it.

Any help is still welcome. I just took a moment to track through the flags, and got results that code I pasted before was a kludge attempt. But now I am suddenly getting it. (funny haha, not funny strange) :lol:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

Ok. New part of the same question:

How do I start a process? I have been having trouble with the Start-Process command.

Any help or recommendations are continually appreciated as I tromp through this new thing.

:great:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

Ok. I'll try and pace myself.
I am trying these, but with no results. Likely really obvious once pointed out. :???:

Code: Select all

[RunRzSy3]
Measure=Plugin
Plugin=RunCommand
Program="C:\Program Files (x86)\Razer\Synapse3\WPFUI\Framework\Razer Synapse 3 Host\Razer Synapse 3.exe"
Parameter=
State=Hide
OutputType=ANSI

[KillRzSy3]
Measure=Plugin
Plugin=RunCommand
Program=Razer Synapse 3
Parameter=taskkill /F /T /IM "Razer Synapse 3.exe"
State=Hide
OutputType=ANSI
Not really clear but I am just tinkering around. Hopefully between breaks, someone might dive in.

Thasnks,
CC

EDIT: I suddenly realised that I might screw things up really bad, so I'll just hold the line for now since I really am in the dark.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Kill Process with RunCOmmand or PSRM questions

Post by Active Colors »

CodeCode wrote: May 4th, 2022, 12:21 pm Ok. I'll try and pace myself.
I am trying these, but with no results. Likely really obvious once pointed out. :???:

Code: Select all

[RunRzSy3]
Measure=Plugin
Plugin=RunCommand
Program="C:\Program Files (x86)\Razer\Synapse3\WPFUI\Framework\Razer Synapse 3 Host\Razer Synapse 3.exe"
Parameter=
State=Hide
OutputType=ANSI

[KillRzSy3]
Measure=Plugin
Plugin=RunCommand
Program=Razer Synapse 3
Parameter=taskkill /F /T /IM "Razer Synapse 3.exe"
State=Hide
OutputType=ANSI
Not really clear but I am just tinkering around. Hopefully between breaks, someone might dive in.

Thasnks,
CC

EDIT: I suddenly realised that I might screw things up really bad, so I'll just hold the line for now since I really am in the dark.
Does this work to you?

Code: Select all

[Close1]
Measure=Plugin
Plugin=RunCommand
Program=taskkill.exe
OutputType=ANSI
Parameter=/F /IM calculator.exe
Also, if your program "Razer Synapse 3.exe" is running with admin rights, you will probably need to kill it as admin too. Just something to keep in mind if Rainmeter is not running as admin. You can do it this way:

Code: Select all

[Close2]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=Start-Process -FilePath "taskkill" -ArgumentList "/IM calculator.exe" -verb RunAs
-verb RunAs elevates the command to the admin level.

There is some other extra note about this powershell command here: https://forum.rainmeter.net/viewtopic.php?t=4194&start=30#p194729
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

Hmm.
Neither of those seem to work.
I tried these variations:

Code: Select all

[KillRzSy3]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=Start-Process -FilePath "taskkill" -ArgumentList "/IM Razer Synapse 3.exe" -verb RunAs

Code: Select all

[KillRzSy3]
Measure=Plugin
Plugin=RunCommand
Program=taskkill.exe
OutputType=ANSI
Parameter=/F /IM Razer Synapse 3.exe
What am I doing wrong?
This works but direct from the commandline:
taskkill /F /T /IM "Razer Synapse 3.exe"
But not like this at all:

Code: Select all

[KillRzSy3]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=taskkill /F /T /IM "Razer Synapse 3.exe"
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Kill Process with RunCOmmand or PSRM questions

Post by Active Colors »

You should be extra cautious with process names that have spaces, like yours "Razer Synapse etc.exe". I simply forget about these rare cases when developers include spaces in their executables' names.

Firstly, try above codes with some exe file which has no spaces. Like notepad.exe or calc.exe.
Then, see what works and what does not.

This should work:

Code: Select all

[Close]
Measure=Plugin
Plugin=RunCommand
Parameter=taskkill /F /IM "Your Program.exe"
OutputType=ANSI
And Yincognito's PowerShell command also works for me:

Code: Select all

[Close]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=Start-Process taskkill -windowstyle Hidden -verb RunAs '/F /FI \"IMAGENAME eq Razor Synapse Etc.exe\"'
OutputType=ANSI
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

OMG!
I was doing something wrong, but not in the RunCommand. It was in the execution.

I was incorrectly doing this, even though I definitely know better: ""[!CommandMeasure KillRzSy3 Run]"". WHere it should rightly be withou the double double-quotes! :oops:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

So, yes.
It is working now.
And the start process is simply the path to and including the [bla].exe

Thanks AC :thumbup:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Kill Process with RunCOmmand or PSRM questions

Post by CodeCode »

Ok, I should explain myself, i think.

The RunCommand measure is actually kept in an inc file due to the nature and design of the skin i am working on here.

That is why the double double-quotes were even being used. Just in my case the default for the variables is set up to use those double double-quotes, to either handle a path or other linked information so that the end user can easily change the link or path to the function they might prefer.

I just forgot to get rid of them for the RunCommand to work, such as it is the [ and ] are needed for that ability in the inc file so that the extra 'ability' measure/s are easily utilised in a location the end user can keep track. The ini code is really really, just really..., lol.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.