Jump to content

Script Help for the Mentally Challenged.


SnM John

Recommended Posts

Hey folks,

before I go bother Luis with a support ticket thought I would check here.

 

I have a custom script I want to make to create a file with inserted parameters. I do this so I don't have to create a config file to insert them.

 

Anyways I have already successfully done this once ( THANK YOU LUIS! )

for one of my games. But it was a simple 2 line .bat file.

 

Code used was like so..........

 

echo %gameserverroot%Game.exe > %gameserverroot%run.bat

 

This is the example that I was given. It worked great...

as you see below he shows me how to add more lines.

 

To add more lines to the file use >> for example:

echo line 1 > run.bat

echo line 2 >> run.bat

 

 

Now my problem is......The current file I want to create is 154 lines long.

Do I really have to use a > for each line? As in will line 154 require 154 of these > things or is there a better way? This is my first venture into scripting so I just don't have a clue. Am I just totally misunderstanding him?

 

 

 

Thanks in advance.

Link to comment
Share on other sites

no, if you use > it will overwrite existing, using >> appends to the end of file

 

like the following:

echo "hi im a dork" >> dork.bat

echo "cp dork.bat d:" >> dorkinstall.bat

echo "d:" >> dorkinstall.bat

echo "dork.bat" >> dorkinstall.bat

 

What this would do is create a file called dork.bat , add the copy command to dorkinstall.bat , add the drive select command to the dorkinstall.bat , and add the execute dork.bat line to dorkinstall.bat

 

this file would be 3 lines long..

 

I'm trying to explain it easy, hopefully that didn't confuse you more...haha

 

In your example, would go

 

echo line 1 >> run.bat

echo line 2 >> run.bat

echo line 3 >> run.bat

echo line 4 >> run.bat

...

 

 

Adam

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Who's Online   0 Members, 0 Anonymous, 18 Guests (See full list)

    • There are no registered users currently online
×
×
  • 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