Script to run 1 process and kill 2 services

Discuss and share scripts and script files...
swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Script to run 1 process and kill 2 services

Post by swan_x »

Hi, i need 2 script:
1) run 1 service (aaa.exe)
2) kill 2 process (aaa.exe & another.exe)

I know taskkill for 1 process, But how to 2 kill process in the same script? And for run 1 service?
Tanxs a lot!

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Script to run 1 processi and kill 2 services

Post by highend »

1.) dos command: net start
2.) if you know how to kill one task, why don't you execute that command twice (second time with a different task name)?
One of my scripts helped you out? Please donate via Paypal

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 processi and kill 2 services

Post by swan_x »

With taskkill aaa.exe,another.exe /F don't Work! And same with aaa.exe;another.exe.....
And to run 1 service?

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Script to run 1 processi and kill 2 services

Post by highend »

I wrote: execute that killtask command twice, not append a ",/;" and the other task name^^

Run service: dos command = net start... If you know how to execute a killtask dos command you can execute a net start <service name> as well?
One of my scripts helped you out? Please donate via Paypal

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 processi and kill 2 services

Post by swan_x »

Ok, i got confused!
Net start work, But not on my specific service (Apple mobile service)... I have try But have a error (name of service invalid)
For kill my 2 process now i try!

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 processi and kill 2 services

Post by swan_x »

I have try: net start appleservice.exe and don't Work...
net service C:Program/dghjj/..../appleservice.exe and don't work.....

For taskkill i have try service one.exe,service to.exe and don't Work.....

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: Script to run 1 processi and kill 2 services

Post by FluxTorpedoe »

swan_x wrote:I have try: net start appleservice.exe and don't Work...
You have to use the "real name" of the service, and not its filename, e.g.:

Code: Select all

net start "Apple Mobile Device"

// Or e.g. straight from XYplorer’s address bar:
::run "%windir%\system32\net.exe start ""Apple Mobile Device""";
---------------------------
highend wrote:I wrote: execute that killtask command twice, not append a ",/;" and the other task name^^
swan_x wrote:For taskkill i have try service one.exe,service to.exe and don't Work.....
Hem Hem…
Appending a coma won’t get you much further!
As highend mentioned, what would be the problem of running the command twice — meaning, running it once on its own line, then running it once again (on another line) with the second task name?

Hope this helps, 8)
Flux

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 processi and kill 2 services

Post by swan_x »

Tanxs for help!
Ok for net start, now i try.

For taskkill, i want at once, kill 2 process....
But if i write taskkill one.exe,second.exe not Work!
Only taskkill one.exe Work, But not togheter.....
Please write one example of correct syntax for kill at once 2 process....

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: Script to run 1 processi and kill 2 services

Post by FluxTorpedoe »

Example using taskkill with the processes filename, to force kill chrome and notepad:

Code: Select all

taskkill /F /IM chrome.exe /IM notepad.exe

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 processi and kill 2 services

Post by swan_x »

Tanxs Flux! I understand.
But for start Apple service, net start Apple mobile service don't work....the service don't start...
And even with windir/system32.....net start Apple service don't start....why?

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Script to run 1 processi and kill 2 services

Post by highend »

Use quotation marks for the service name or even better, the real service name?
One of my scripts helped you out? Please donate via Paypal

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: Script to run 1 processi and kill 2 services

Post by FluxTorpedoe »

You need to use the exact name of the service as it is listed in your system.
Look for the name in the services console.
"Start" button > ("Run", or in the Find field) > type "services.msc" > Enter > Read the "Name" column to find your service.

You can also check its status (and dependencies) there.

Edit: highend beat me to it… :wink:

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 process and kill 2 services

Post by swan_x »

Yes I have write the exact name of the service, but don't run....
Only run if I go to services on them run it manually.....

highend
Posts: 14942
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Script to run 1 process and kill 2 services

Post by highend »

Then show the real script and it's output when it's executed?
One of my scripts helped you out? Please donate via Paypal

swan_x
Posts: 335
Joined: 08 Oct 2009 12:27

Re: Script to run 1 process and kill 2 services

Post by swan_x »

For kill 2 my service it's ok!! Work!
For start my Apple service I don't have a error message, simply the service not run!

Post Reply