question about batch-files

Discussion about NBA Live 2003.

question about batch-files

Postby Tuomas on Sat Apr 26, 2003 11:15 pm

I learned to make batch files,
what command have to I type to make the prog clear the screen?
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

Postby Andrew on Sun Apr 27, 2003 6:26 pm

"CLS", without the quotations.
User avatar
Andrew
Retro Basketball Gamer
Administrator
 
Posts: 115161
Joined: Thu Aug 22, 2002 8:51 pm
Location: Australia

thanks

Postby Tuomas on Mon Apr 28, 2003 12:56 am

thanks for help.
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

reply

Postby Tuomas on Mon Apr 28, 2003 10:51 pm

Is it possible for the batch to RENAME a file? If is, how?
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

Postby Andrew on Tue Apr 29, 2003 6:05 pm

Of course. The command is:

REN (old name) (newname)

Make sure you include all file extensions (eg .fish) when renaming.
User avatar
Andrew
Retro Basketball Gamer
Administrator
 
Posts: 115161
Joined: Thu Aug 22, 2002 8:51 pm
Location: Australia

Postby Nick on Tue Apr 29, 2003 6:06 pm

"ren" without the quotation marks.

so if you typed...

"ren xxxxx.fsh mijorda.fsh" without the " marks then that would rename xxxxx.fsh to mijorda.fsh. (Y)
User avatar
Nick
Barnsketball
Contributor
 
Posts: 6536
Joined: Sun Sep 15, 2002 9:01 pm
Location: Melbourne, Australia

Postby Andrew on Tue Apr 29, 2003 8:03 pm

You might also be interested in the MOVE command. It can save you the trouble of executing two commands in batch file (eg COPYing a file, then DELeting it).
User avatar
Andrew
Retro Basketball Gamer
Administrator
 
Posts: 115161
Joined: Thu Aug 22, 2002 8:51 pm
Location: Australia

reply

Postby Tuomas on Tue Apr 29, 2003 11:46 pm

Thanks for help again. I knew the move command.... I think making batch files is fun :lol:
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

more

Postby Tuomas on Wed Apr 30, 2003 12:11 am

Oh, forgot to ask.
Is there any more cool commands I could be interested in?
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

Postby Cameron on Wed Apr 30, 2003 3:25 am

If you want to write stuff to the person using the batch file, write
@echo off
at the top of the batch file, and then when you want to say something, use
echo Hello! This installs the VC update...

The other thing to do is when you run a batch file with something you'd like to use in it, like "if you want to exit press control c" or something, right click on the file and choose edit, and then you can "steal" the code.
User avatar
Cameron
 
Posts: 1419
Joined: Sat Jan 18, 2003 5:01 am
Location: Canada

Postby Andrew on Wed Apr 30, 2003 4:28 pm

There's also a PAUSE command. I use this in the NLSC roster update, after the "Press Control-C to abort installation" line.

Code: Select all
ECHO You can press CRTL-C at any time to abort.
ECHO.
PAUSE
User avatar
Andrew
Retro Basketball Gamer
Administrator
 
Posts: 115161
Joined: Thu Aug 22, 2002 8:51 pm
Location: Australia

Postby Nick on Wed Apr 30, 2003 9:59 pm

Qweet wrote:If you want to write stuff to the person using the batch file, write
@echo off
at the top of the batch file, and then when you want to say something, use
echo Hello! This installs the VC update...

Hey Qweet, Can you explain further what you mean? i'm just curious...sounds like a cool command...
(i've always just used @ echo off
User avatar
Nick
Barnsketball
Contributor
 
Posts: 6536
Joined: Sun Sep 15, 2002 9:01 pm
Location: Melbourne, Australia

more

Postby Tuomas on Wed Apr 30, 2003 10:15 pm

:lol: I added a cool batch file to my VC patch
Grab the patch here:
http://koti.mbnet.fi/finnboy/FB-VC3-FB.zip

The batch first deletes all the files in VC:s folder, then adds the files there, and if there isn't the folder, it creates one. :wink:
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

Postby Cameron on Wed Apr 30, 2003 10:17 pm

The ECHO command is used pretty well for making the bat program user friendly. For example, you could say "hey welcome to my patch", describe what the patch does, say "patch installed succesfully!" at the bottom, etc. This is an example of a batch with no @echo off and no echo's

Code: Select all
ren happy.txt sad.txt
del sad.txt
pause

Image

And here's one with some nice echo's

Code: Select all
@echo off
echo Welcome to my redundant patch!
echo Renaming happy.txt to sad.txt...
ren happy.txt sad.txt
del sad.txt
echo sad.txt is deleted successfully!:)
pause

Image

As you can see, the second one is much more user friendly than the first. BTW, all the @echo off command is for other than enabling the ECHO command is so that the statements that are executing (ie Ren and Del) are not outputted to the screen.
User avatar
Cameron
 
Posts: 1419
Joined: Sat Jan 18, 2003 5:01 am
Location: Canada

Postby Andrew on Thu May 01, 2003 1:44 pm

You can also ensure that the command lines are not printed on screen by adding "> NUL" after a command. For example:

Code: Select all
IF NOT EXIST saves\000\players.dbf MD saves [b]> NUL[/b]
User avatar
Andrew
Retro Basketball Gamer
Administrator
 
Posts: 115161
Joined: Thu Aug 22, 2002 8:51 pm
Location: Australia

Postby Filip on Sun May 04, 2003 2:13 am

I would like to know from the beginning how to make batch file.
User avatar
Filip
 
Posts: 3911
Joined: Fri Jan 03, 2003 7:59 am
Location: England

Postby Filip on Sun May 04, 2003 5:08 am

After looking in a cyberface batch file I could figure out a little bit the system. So I actually managed to do a batch files that extract all the files,
delete the old ones and creating new ones (if there were none).
But in my Roster Patch I have 2 saves, which means that I have 2 of everything, and beacause that I have to rename them (as you were talking about) to make it work.

But it didnt work. It copied but, it didnt changed the names!

ren VC4.jpg VC5.jpg
pause
md Test\000 >nul
md Test\001 >nul
move VC4.jpg Test\000\
move VC5.jpg Test\001\

They both got were I wanted them, but I wanted VC4.jpg to be renamed to VC5.jpg.
But I got some stupid error message instead. HELP!
User avatar
Filip
 
Posts: 3911
Joined: Fri Jan 03, 2003 7:59 am
Location: England

Postby Andreas Dahl on Sun May 04, 2003 6:03 am

what command is there for automatic install?, so you don't have to push a button wgen installing?
Image
User avatar
Andreas Dahl
 
Posts: 5970
Joined: Sat Dec 07, 2002 10:04 pm
Location: Växjö, Sweden

Postby Cameron on Sun May 04, 2003 9:09 am

Slam harder wrote:After looking in a cyberface batch file I could figure out a little bit the system. So I actually managed to do a batch files that extract all the files,
delete the old ones and creating new ones (if there were none).
But in my Roster Patch I have 2 saves, which means that I have 2 of everything, and beacause that I have to rename them (as you were talking about) to make it work.

But it didnt work. It copied but, it didnt changed the names!

ren VC4.jpg VC5.jpg
pause
md Test\000 >nul
md Test\001 >nul
move VC4.jpg Test\000\
move VC5.jpg Test\001\

They both got were I wanted them, but I wanted VC4.jpg to be renamed to VC5.jpg.
But I got some stupid error message instead. HELP!


You say that both files were moved properly... but you can't rename VC4 to VC5. This is because you already have a file called VC5 in the same directory as VC4, so it can't rename it to a filename that already exists. There are a few ways to fix this, the easiest way I can think of would be this:
Code: Select all
pause
md Test\000 >nul
md Test\001 >nul
move VC5.jpg Test\001\
ren VC4.jpg VC5.jpg
move VC4.jpg Test\000\


Try this now, it should work.
User avatar
Cameron
 
Posts: 1419
Joined: Sat Jan 18, 2003 5:01 am
Location: Canada

Postby Filip on Sun May 04, 2003 7:18 pm

Thanx 4 the help but I managed to fix it in another way after looking in
Andrew`s update
User avatar
Filip
 
Posts: 3911
Joined: Fri Jan 03, 2003 7:59 am
Location: England

Postby Andreas Dahl on Mon May 12, 2003 3:46 am

hmm, i got a complain about a .bat file i made..., my question is; do you need to have the folder that is specefied in the .bat file?, i meen, if the bat file will send a file to the xcommon folder, do you need to have that there already?
Image
User avatar
Andreas Dahl
 
Posts: 5970
Joined: Sat Dec 07, 2002 10:04 pm
Location: Växjö, Sweden

Postby Andrew on Mon May 12, 2003 11:59 am

If it's not there, you can create it with the MD command:

MD foldername

You can also see if a folder/file exists. I use this command in the NLSC roster update:

IF NOT EXIST saves\000\players.dbf MD saves\000
User avatar
Andrew
Retro Basketball Gamer
Administrator
 
Posts: 115161
Joined: Thu Aug 22, 2002 8:51 pm
Location: Australia

more...

Postby Tuomas on Sat May 17, 2003 3:30 pm

Is it possible for a batch file to run a program, for example another batch file or a .exe file? If if, how?
This could enable many possibilities.... :P
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland

Re: more...

Postby Tuomas on Sat May 17, 2003 4:42 pm

Finnboy wrote:Is it possible for a batch file to run a program, for example another batch file or a .exe file? If if, how?
This could enable many possibilities.... :P

Nah, forget it, I figured it out already.
Check my discovery at the NBA Live 2003 Announcements
under the topic named:
FIRST TIME EVER - CHANGING CORNROWS FOR AI
:wink:
User avatar
Tuomas
 
Posts: 3166
Joined: Sun Mar 30, 2003 4:59 pm
Location: Finland


Return to NBA Live 2003

Who is online

Users browsing this forum: No registered users and 4 guests