Jump to content

How to make a run.bat file start another run.bat file

So im running a csgo server. But it doesnt autoupdate. I have a update.bat that updates the server. But it would be great if I could add so that when the update.bat file has update - it automaticly would start the start.bat (wich is the csgoserver itself)

How do I do that? 

The update script looks like:

 

steamcmd +force_install_dir C:\csgoserver +login anonymous +app_update 740 validate +C:\csgoserver\start.bat +exit

 

Note: The bold text is what i want the script to do, but it doesnt.

Any programmers here that could help a man set up an automatic server update?

i9-9900k 5.0ghz, 16gb Corsair 3600mhz, Asrock phantom itx z390 Mobo, RTX 3060ti, 1TB+1TB Western digital NVME, InWin A1, Noctua NH-U12S

 

Link to comment
Share on other sites

Link to post
Share on other sites

You could use the CALL command in the .BAT file : https://ss64.com/nt/call.html

 

Another option would be to use START : https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/start

 

something like

 

start "steam job" /d "c:\folder_of_steamcmd" /wait /elevate steamcmd +force_install_dir C:\csgoserver +login anonymous +app_update 740 validate

start "start csgo job" /d "C:\csgoserver" /wait /elevate C:\csgoserver\start.bat

 

/wait means start launches that command and waits until the process closes

/elevate is optional, only needed if you want to run commands as administrator - you may not want to run a "game server" as administrator but the tools that update the code may need administrative rights to update files.

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, mariushm said:

You could use the CALL command in the .BAT file : https://ss64.com/nt/call.html

 

Another option would be to use START : https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/start

 

something like

 

start "steam job" /d "c:\folder_of_steamcmd" /wait /elevate steamcmd +force_install_dir C:\csgoserver +login anonymous +app_update 740 validate

start "start csgo job" /d "C:\csgoserver" /wait /elevate C:\csgoserver\start.bat

 

/wait means start launches that command and waits until the process closes

/elevate is optional, only needed if you want to run commands as administrator - you may not want to run a "game server" as administrator but the tools that update the code may need administrative rights to update files.

What did I do wrong? xD

 

image.png.98c3ba48bdd1cca288361e3f40b99b34.png

i9-9900k 5.0ghz, 16gb Corsair 3600mhz, Asrock phantom itx z390 Mobo, RTX 3060ti, 1TB+1TB Western digital NVME, InWin A1, Noctua NH-U12S

 

Link to comment
Share on other sites

Link to post
Share on other sites

Also got this image.png.3bfb2dda91d6c7ade24f03441c6c3dec.png

i9-9900k 5.0ghz, 16gb Corsair 3600mhz, Asrock phantom itx z390 Mobo, RTX 3060ti, 1TB+1TB Western digital NVME, InWin A1, Noctua NH-U12S

 

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks dude! I ended up running this: 

 

start /d c:\steamcmd /wait steamcmd +force_install_dir C:\csgoserver +login anonymous +app_update 740 validate +exit

start /d c:\csgoserver /wait C:\csgoserver\start.bat

 

But what command do I use so this(pciture) shuts down after everything is done ? image.png.de97c445763b35e0114f3a9884aee3b4.png

i9-9900k 5.0ghz, 16gb Corsair 3600mhz, Asrock phantom itx z390 Mobo, RTX 3060ti, 1TB+1TB Western digital NVME, InWin A1, Noctua NH-U12S

 

Link to comment
Share on other sites

Link to post
Share on other sites

you can use @echo off at the start of the batch file to disable display of commands

you can say echo  the text you want on screen to show something on screen

you can say exit to close the command prompt

 

so your batch file could be something like this

@echo off

echo Step 1 of 2. Launching steam

<steam command>

echo Step 2 of 2. Launching start.bat ...

<command>

echo "Done. Closing in 5  seconds."

timeout /T 5

exit

 

and the window should close.

 

If you want that start.bat to start and just run in background and have the original command prompt close, just don't use /wait for that command.

You can also use /min in the command (see all the parameters for start in the link) to make start auto minimize the start.bat 's command prompt as it's launched

 

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

×