Jump to content

Batch file to crash application

Go to solution Solved by JacobFW,
17 minutes ago, DragonTamer1 said:

 

Okay so I got it set up in task scheduler (I think).

 

Will task scheduler start this in the event of a restart (fairly frequent power outages)?

Make sure this option is checked

image.png.124816542dc4b74a3f6b301e9072ee4b.png

 

Additionally, to test that the task will work as expected, make sure the one above it "Allow task to be run on demand" is checked as well, then you can right click on the task on the main screen and run it at any time to make sure it works correctly.

 

So I host a DCS server and have a weird issue where the re-spawn scripts stop working if it runs for too long. It also tends to fall behind on updates.

 

I would like to have a batch file that force crashes the game at the same every day by the system clock, say 5 AM. I have scripts in place that automatically restart the server so that is not an issue.

 

@ echo off
cls

FOR /F "tokens=1,2 delims=:." %%A IN ("%Time%") DO (
	SET Hours=%%A
	SET Minutes=%%B
)
SET /A Hours = 100%Hours% %% 100
ECHO.%Minutes% | FIND /I "P" >NUL && SET /A Hours += 12
SET Minutes=%Minutes:~0,2%
SET /A Minutes = 100%Minutes% %% 100

taskkill /F /IM notepad.exe
pause

This is what I have but to be honest, I have no idea what most of it is. I'm using notepad as my reference program for the script and will change it later.

Intel Xeon 1650 V0 (4.4GHz @1.4V), ASRock X79 Extreme6, 32GB of HyperX 1866, Sapphire Nitro+ 5700XT, Silverstone Redline (black) RL05BB-W, Crucial MX500 500GB SSD, TeamGroup GX2 512GB SSD, WD AV-25 1TB 2.5" HDD with generic Chinese 120GB SSD as cache, x2 Seagate 2TB SSHD(RAID 0) with generic Chinese 240GB SSD as cache, SeaSonic Focus Plus Gold 850, x2 Acer H236HL, Acer V277U be quiet! Dark Rock Pro 4, Logitech K120, Tecknet "Gaming" mouse, Creative Inspire T2900, HyperX Cloud Flight Wireless headset, Windows 10 Pro 64 bit
Link to comment
https://linustechtips.com/topic/1056109-batch-file-to-crash-application/
Share on other sites

Link to post
Share on other sites

Why use a script?

 

Windows task scheduler or CRON will do the exact same thing without any of the hassle.

Main Rig:-

Ryzen 7 3800X | Asus ROG Strix X570-F Gaming | 16GB Team Group Dark Pro 3600Mhz | Corsair MP600 1TB PCIe Gen 4 | Sapphire 5700 XT Pulse | Corsair H115i Platinum | WD Black 1TB | WD Green 4TB | EVGA SuperNOVA G3 650W | Asus TUF GT501 | Samsung C27HG70 1440p 144hz HDR FreeSync 2 | Ubuntu 20.04.2 LTS |

 

Server:-

Intel NUC running Server 2019 + Synology DSM218+ with 2 x 4TB Toshiba NAS Ready HDDs (RAID0)

Link to post
Share on other sites

Just to clarify what Master Disaster means.

 

Write your batch file to just kill the task.  Don't worry about the time there.

 

Use Windows Task Scheduler to create a task that runs the batch file at a specific time of day.

https://docs.microsoft.com/en-us/windows/desktop/taskschd/task-scheduler-start-page

 

 

Link to post
Share on other sites

9 hours ago, Master Disaster said:

Why use a script?

 

Windows task scheduler or CRON will do the exact same thing without any of the hassle.

 

16 minutes ago, JacobFW said:

Just to clarify what Master Disaster means.

 

Write your batch file to just kill the task.  Don't worry about the time there.

 

Use Windows Task Scheduler to create a task that runs the batch file at a specific time of day.

https://docs.microsoft.com/en-us/windows/desktop/taskschd/task-scheduler-start-page

 

 

Okay so I got it set up in task scheduler (I think).

 

Will task scheduler start this in the event of a restart (fairly frequent power outages)?

Intel Xeon 1650 V0 (4.4GHz @1.4V), ASRock X79 Extreme6, 32GB of HyperX 1866, Sapphire Nitro+ 5700XT, Silverstone Redline (black) RL05BB-W, Crucial MX500 500GB SSD, TeamGroup GX2 512GB SSD, WD AV-25 1TB 2.5" HDD with generic Chinese 120GB SSD as cache, x2 Seagate 2TB SSHD(RAID 0) with generic Chinese 240GB SSD as cache, SeaSonic Focus Plus Gold 850, x2 Acer H236HL, Acer V277U be quiet! Dark Rock Pro 4, Logitech K120, Tecknet "Gaming" mouse, Creative Inspire T2900, HyperX Cloud Flight Wireless headset, Windows 10 Pro 64 bit
Link to post
Share on other sites

17 minutes ago, DragonTamer1 said:

 

Okay so I got it set up in task scheduler (I think).

 

Will task scheduler start this in the event of a restart (fairly frequent power outages)?

Make sure this option is checked

image.png.124816542dc4b74a3f6b301e9072ee4b.png

 

Additionally, to test that the task will work as expected, make sure the one above it "Allow task to be run on demand" is checked as well, then you can right click on the task on the main screen and run it at any time to make sure it works correctly.

 

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

×