Jump to content

need help with a script

Pandora
Go to solution Solved by BeefyMeats,

I would just create a scheduled task to run a batch file

:loop
start "c:\blaablaa\shittyProgram.exe -parameters"
timeout /t 36000 && taskkill /f /im shittyProgram.exe
timeout /t 30

goto loop

 

so i am a complete programing and such noob, other than basic if than stuff in python i know nothing. for the first time in a long time i have found my self in need of a script.

i run a few game servers for a game that went down a few weeks ago (mirage arcane warfare) and the server tool is total trash. it needs to be launched via a shortcut with launch options, more than one instance cannot be run per os, there is no logging feature or even a basic cmd prompt window to tell me if its running.

in order for me to know the server is running i need to check the task manager, and in order to shut down the server i need to kill it via task manager (legit this is the only way).

now this wouldnt be a problem if i could just press run and let it go but because the server software is such garbage the server starts to have issues after 12 hours and becomes completely unusable after 24 and as such needs to be killed and relaunched.

 

i have no idea how to do this other than manually, i don't even know where to find the resources to find out. i assume something with autohotkey would work but i don't know how to use that.

 

if i could get some direction that would be awesome.

 

CPU: I7 8700k @ 5ghz | Motherboard: Asus Z370-Prime | RAM: White Crucial balistix DDR4 2133mhz | GPU: GTX 1080TI | Storage: ssd HyperX 240gig, 2x2tb seagate Firecuda 1tb, BPX 480 gig nvme, 1tb sandisk ssd  | Cooling: Custom loop | PSU: Evga supernova 850w G2 | Case: Phanteks enthoo evolv atx black White modded | system theme: White/RGB/Weiss

Link to comment
Share on other sites

Link to post
Share on other sites

I read over this a few times, and I don't quite understand what you're trying to say.

 

From what I can understand is:

 

You have this service that you can only terminate through task manager and you can only kill it in task manager.

 

You want a script that you can click and kill the service?
 

If so, try this in notepad and save as .bat (batch file):

 

taskkill /F /FI "SERVICES eq yourservice"

 

Cheers

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Netivity said:

I read over this a few times, and I don't quite understand what you're trying to say.

 

From what I can understand is:

 

You have this service that you can only terminate through task manager and you can only kill it in task manager.

 

You want a script that you can click and kill the service?
 

If so, try this in notepad and save as .bat (batch file):

 


taskkill /F /FI "SERVICES eq yourservice"

 

Cheers

thank you, thats kinda what i was looking for. i didnt realize that you could kill programs from notepad. ill do my homework and try to figure out how i can use it to relaunch the program and how i can get it to work on a timer or something.

CPU: I7 8700k @ 5ghz | Motherboard: Asus Z370-Prime | RAM: White Crucial balistix DDR4 2133mhz | GPU: GTX 1080TI | Storage: ssd HyperX 240gig, 2x2tb seagate Firecuda 1tb, BPX 480 gig nvme, 1tb sandisk ssd  | Cooling: Custom loop | PSU: Evga supernova 850w G2 | Case: Phanteks enthoo evolv atx black White modded | system theme: White/RGB/Weiss

Link to comment
Share on other sites

Link to post
Share on other sites

I would just create a scheduled task to run a batch file

:loop
start "c:\blaablaa\shittyProgram.exe -parameters"
timeout /t 36000 && taskkill /f /im shittyProgram.exe
timeout /t 30

goto loop

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, BeefyMeats said:

I would just create a scheduled task to run a batch file


:loop
start "c:\blaablaa\shittyProgram.exe -parameters"
timeout /t 36000 && taskkill /f /im shittyProgram.exe
timeout /t 30

goto loop

 

I would set up a cron rather than asking a batch file to sleep. 

 

Kill the server and then reopen.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×