Running a *.bat file automatically before a server starts

Having problems with the panel? Have questions? Post here!
Post Reply
MattBaxter
Posts: 3
Joined: Sat Jul 08, 2017 12:44 am

Running a *.bat file automatically before a server starts

Post by MattBaxter »

I need to run a bat file before a server starts.
The file is a simple file copy but it wont overwrite the files if the gameserver is running.
So i have the server set to auto restart at 4.30 am in the morning which is when the server is empty.
Was hoping to have the bat file run when the auto restart process does its thing.

I thought I could use the "Run command before server start" option, see image attached, but I wasnt sure how to phrase the execution of a bat file.
The other idea was to set up a schedule on the server and have that run the bat file but I need to get the timing just right.

Any other suggestions?
Attachments
Capture.JPG
Masher
Site Admin
Posts: 3612
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland
Contact:

Re: Running a *.bat file automatically before a server starts

Post by Masher »

To run a batch file you need to use cmd.exe. Something like

Code: Select all

C:\Windows\System32\cmd.exe \c "C:\Path\to\file.bat"
More info on the cmd command is available at https://docs.microsoft.com/en-us/window ... mmands/cmd
Masher
-----------
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
Post Reply