Jump to content

batch help


kroko

Recommended Posts

hallo, i am trying to create a custom icon script. everytime a person click on it, it will delete maplist.txt and generate a new one with all the maps that is in the maps folder. what i have so far is:

 

@echo off
del maplist.txt
cd maps
For %%a in (*.bsp) do @echo %%~na >>"%~dp0maplist.txt"
echo List Generated!
pause

 

if i have that then i need a bat file on each game server (in cstrike folder) for it to work. do anyone of you know a seloution that would work out of the box without having any script on the game server? i do not know much about batch scripting so if you say something advanced, then i would not understand! :p i got the current script from here http://forums.srcds.com/viewtopic/15871

 

 

Thanks in advance

kroko

Link to comment
Share on other sites

so i can just create a custom icon and use that as script?

 

EDIT: I tryed using this

 

@echo off

cd cstrike

del maplist.txt

cd maps

For %%a in (*.bsp) do @echo %%~na >>"%~dp0maplist.txt"

echo List Generated!

pause

 

but that just deleted maplist.txt and diddent create it again. anyone know why?

Edited by kroko
Link to comment
Share on other sites

cd %ThisService_WorkingDirectory%

del \q maplist.txt

cd maps

For %%a in (*.bsp) do @echo %%~na >>"%ThisService_WorkingDirectory%maplist.txt"

 

that should work

 

i get this

Could Not Find C:\q
C:\TCAFiles\Users\kroko\12>cd C:\TCAFiles\Users\kroko\12\ 
Could Not Find C:\TCAFiles\Users\kroko\12\maplist.txt

The system cannot find the path specified.
C:\TCAFiles\Users\kroko\12>del \q maplist.txt 

C:\TCAFiles\Users\kroko\12>cd maps 

C:\TCAFiles\Users\kroko\12>For %a in (*.bsp) do @echo %~na 1>>"C:\TCAFiles\Users\kroko\12\maplist.txt" 

The script has executed successfully. You may close this window.

 

 

 

maplist.txt is located in cstrike folder and not root

 

 

 

i modifyed your script to this

cd %ThisService_WorkingDirectory%cstrike

del maplist.txt

cd maps

For %%a in (*.bsp) do @echo %%~na >>"%ThisService_WorkingDirectory%maplist.txt"

 

that is creating the maplist.txt. but it is doing so in root. do you know how to get it to make it in the cstrike folder?

Edited by kroko
Link to comment
Share on other sites

nvm, got this to work

 

cd %ThisService_WorkingDirectory%cstrike

del maplist.txt

cd maps

For %%a in (*.bsp) do @echo %%~na >>"%ThisService_WorkingDirectory%cstrike\maplist.txt"

 

 

Thanks alot for your help :)

Link to comment
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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use