Errors in batch code, for a startup script to prepare for a game loading

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Swagnatti
Posts: 1
Joined: 03 Apr 2016 20:01

Errors in batch code, for a startup script to prepare for a game loading

#1 Post by Swagnatti » 03 Apr 2016 20:22

Hello, i recently made some stuff on a game i have, and to use it, i'd normally have to go to a folder, open two different files as an admin, then go back and open another file, blah blah blah...
So i made a little time saver .bat file, so that i can just click it, and it does everything for me. The scrip is meant to check if MySQL is open, (which is required for the game to run) and then check if Skype is running (as skype blocks one the required ports). If MySQL is not running the batch files launches a vbs message telling the user to open mysql, and if skype is running it tells the user to close it. Here's the code of the batch file:

Code: Select all

@echo off
tasklist /nh /fi "imagename eq mysqld.exe" | find /i "mysqld.exe" >nul && (
cd "C:\Users\PauloHenrique\Desktop\Deep Realms Server\Server Files\Rotmg PServer\Gummy's Realm\bin\Debug"
start server.exe
cd "C:\Users\PauloHenrique\Desktop\Deep Realms Server\Server Files\Rotmg PServer\Gummy's Realm\bin\Debug"
start wServer.exe
exit
) || (
cd "C:\Users\PauloHenrique\Desktop\Deep Realms Server\Server Files\Rotmg PServer\Gummy's Realm"
start error.vbs
)
pause>nul
) || (
tasklist /nh /fi "imagename eq mysqld.exe" | find /i "mysqld.exe" >nul && (
tasklist /nh /fi "imagename eq Skype.exe" | find /i "Skype.exe" >nul && (
cd "C:\Users\PauloHenrique\Desktop\Deep Realms Server\Server Files\Rotmg PServer\Gummy's Realm"
start portblocked.vbs
cd "C:\Users\PauloHenrique\Desktop\Deep Realms Server\Server Files\Rotmg PServer\Gummy's Realm\bin\Debug"
start server.exe
cd "C:\Users\PauloHenrique\Desktop\Deep Realms Server\Server Files\Rotmg PServer\Gummy's Realm\bin\Debug"
start wServer.exe
)
pause>nul


The thing is, i don't have much understanding of batch coding, so everything you see there i either made with some knowledge i got watching some basic tutorials on youtube or i copypasted from other forums. The thing is, it doesn't check if skype is on after cheking if mysql is on, and i don't know how to make it do that. If you could edit it to make it work correctly i'd greatly appreciate it. Additionally, if possible, i wanted to have the program to check if port 80 is blocked/being used instead of checking if skype on, as other programs may also use port 80.
Thanks,
-Paul

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Need help for a startup scrip for a little game.

#2 Post by foxidrive » 05 Apr 2016 08:27

Swagnatti wrote:if possible, i wanted to have the program to check if port 80 is blocked/being used instead of checking if skype on, as other programs may also use port 80.


What do you mean by blocked? A web browser uses port 80 - Firefox, Chrome, MSIE, Opera, Waterfox etc etc

Post Reply