Windows 10 program stop bat file

rgMekanic

[H]ard|News
2FA
Joined
May 13, 2013
Messages
6,942
Hey all, working on a little thing to make my life easier, wanted to make a bat that opens and closes the programs I only use when gaming.

The open works great, the close not so much.

Start
Code:
@echo off

start "afterburner" "C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe"
start "rtss" "C:\Program Files (x86)\RivaTuner Statistics Server\RTSS.exe"
start "rainmeter" "C:\Program Files\Rainmeter\Rainmeter.exe"
start "core temp" "C:\Program Files\Core Temp\Core Temp.exe"

Works great.

The stop however, only seems to close rainmeter, tried with or without the /f

Code:
@echo off

taskkill /f /im MSIAfterburner.exe
taskkill /f /im RTSS.exe
taskkill /f /im Rainmeter.exe
taskkill /f /im Core Temp.exe


I know fuckall about writing any kind of code or scripts, so any help is appreciated.

Thanks!
 
You need to put quotes around parameters with spaces in them.

As for the other two, what output do you get if you run the command from the command prompt instead of via bat file?
 
examples:

services: net stop "COM+ System Application" /Y

files: process -k avgnt.exe
 
You need to put quotes around parameters with spaces in them.

As for the other two, what output do you get if you run the command from the command prompt instead of via bat file?

Quotes made no difference. Running one of them in cmd resulted in

ERROR: The process "Core Temp.exe" with PID 7528 could not be terminated.
Reason: Access is denied.

same for the others

Right-click "run as administrator" successfully killed all the talks in the bat.
 
Well without quotes it won't work at all, but it's not working now because you probably need elevated privileges to kill those processes.

Run the bat file as administrator.
 
Well without quotes it won't work at all, but it's not working now because you probably need elevated privileges to kill those processes.

Run the bat file as administrator.

You are right, I didn't test it with/without quotes as admin heh. Made a shortcut to it and set the shortcut to run as admin, working perfectly now.

Thanks a bunch, I wouldn't have thought of trying to run it in cmd and see the result to know what to fix heh. :)

Now if I can figure out how to program them to macros on my Deck keybaord :p
 
Back
Top