Batch files

Batch files

Re: Batch files Posted by Koa on Thu Mar 4th 2004 at 7:01am
Koa
27 posts
Posted 2004-03-04 7:01am
Koa
member
27 posts 3 snarkmarks Registered: Feb 24th 2004
I want to make a simple batch file to copy a .bsp file from the folder i edit them from to the mod directory for testing.
Heres the path of the file i want to copy:

C:\\Mapping\\My Maps\\beta_1.bsp

Heres the path of the directory i want to paste it to:

C:\\Program Files\\Steam\\SteamApps\\blah@blah.com\\team fortress classic\\tfc\\maps

(yes, i looked around the net for batch file tutorials....i could have spent days reading it and figuring it out but i want to edit maps, not learn to write batch files)

Thanks
Re: Batch files Posted by fraggard on Thu Mar 4th 2004 at 7:28am
fraggard
1110 posts
Posted 2004-03-04 7:28am
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
In <filename.bat>, write

copy C:\\Mapping\\My Maps\\beta_1.bsp C:\\Program Files\\Steam\\SteamApps\\blah@blah.com\\team fortress classic\\tfc\\maps

and save it.

It would have take you around two seconds to learn that :wtf:
Re: Batch files Posted by Crono on Thu Mar 4th 2004 at 7:32am
Crono
6628 posts
Posted 2004-03-04 7:32am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
If you use 'mv' then the file you want to move then '..' then the entire directory path. It will CUT the file instead of copy it. Mess around with it, after all it's just DOS commands. goto RUN type in cmd or command and mess around.

And fraggard should be marked as blue, if he were to change his comment to a solution :smile:

Also, for copying you can use 'cp' instead of 'copy'

By the way: Look here This was the FIRST file that came up in a search on google with the word "batch"
Re: Batch files Posted by Koa on Thu Mar 4th 2004 at 7:38am
Koa
27 posts
Posted 2004-03-04 7:38am
Koa
member
27 posts 3 snarkmarks Registered: Feb 24th 2004
fraggard said:
"It would have take you around two seconds to learn that :wtf: "

Unfortunatly,Not in the sites I found. Do a google, and imagine youve never written a batch file, youll see what I mean. But anyways....Thanks a lot for the answer!
Re: Batch files Posted by Koa on Thu Mar 4th 2004 at 7:45am
Koa
27 posts
Posted 2004-03-04 7:45am
Koa
member
27 posts 3 snarkmarks Registered: Feb 24th 2004
I see what your saying about the commands,Crono. I think I can use this a lot. Thanks for the replies guys.

Id argue my point about reading an entire site about making batch files when i only need two lines of code, but that time i wanted to save, wouldnt be getting saved lol

thanks again.....
Re: Batch files Posted by fraggard on Thu Mar 4th 2004 at 8:02am
fraggard
1110 posts
Posted 2004-03-04 8:02am
fraggard
member
1110 posts 220 snarkmarks Registered: Jul 8th 2002 Occupation: Student Location: Bangalore, India
I changed it to an answer, but it still doesn't seem to be much of a question :/

Anyway...
Re: Batch files Posted by Crono on Thu Mar 4th 2004 at 8:08am
Crono
6628 posts
Posted 2004-03-04 8:08am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
Koa, they're just DOS commands. Look those up and write them in a text file and save it as a *.bat . . . . I mean . . . . that's all a batch file is. Also, the link I put up has pretty nice commands, which are only to be used from a batch file (which if you were so inclined you could use as your WHOLE hammer compile process :smile: )

But to each his own.

[EDIT]
Fraggard, but it'll still give you the unredeamable snarkmarks :smile:
[/EDIT]
Re: Batch files Posted by Orpheus on Thu Mar 4th 2004 at 9:29am
Orpheus
13860 posts
Posted 2004-03-04 9:29am
Orpheus
member
13860 posts 2024 snarkmarks Registered: Aug 26th 2001 Occupation: Long Haul Trucking Location: Long Oklahoma - USA
take any pre-existing batch file..
  • delete contents
  • copy/paste the contents of the workable solution that either fraggard or crono have offered..
  • save
    </LI>
and you have a functional batch file.

[edited] so there is no f**king chance of it being used to get snarkmarks... geeze guys :rolleyes: [/edit]
Re: Batch files Posted by Crono on Thu Mar 4th 2004 at 10:39am
Crono
6628 posts
Posted 2004-03-04 10:39am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
...that is the most half assed answer ever :razz:

Also, a batch file is JUST a text file with a .bat extention . . . . so couldn't he just make a new text file and rename it? . . . that would seem easier to me.

By the way the question is retorical because the answer is yes, yes you can. :biggrin:
Re: Batch files Posted by Orpheus on Thu Mar 4th 2004 at 11:31am
Orpheus
13860 posts
Posted 2004-03-04 11:31am
Orpheus
member
13860 posts 2024 snarkmarks Registered: Aug 26th 2001 Occupation: Long Haul Trucking Location: Long Oklahoma - USA
crono, i am not sure if i should be amused or annoyed, but since amused is easier, and BTW much safer, i will side with caution :biggrin:

sometimes.. especially with windows XP, i found it very difficult to do anything with dos commands, somehow my success rate was not very good, as opposed to my win98 days.

at any rate, i found it easier to get a working bat file, edit its contents and renaming it to suit..

chaulk it up to my overwhelming stupidity, but it works for me.

as i read his question, i got the impression that he also had issues creating an original batch file.. so i offered an alternative.

if its inappropriate.. my apologies to master koa
Re: Batch files Posted by fishy on Thu Mar 4th 2004 at 2:37pm
fishy
2623 posts
Posted 2004-03-04 2:37pm
fishy
member
2623 posts 1476 snarkmarks Registered: Sep 7th 2003 Location: glasgow
OMG!!!!!!!FFS!!!!!!!etc.etc.

i double-clicked a .bat file to open it and edit it. it was one that i got in my email. now i have dancing badgers all over my screen.

what gives?

:lol:
Re: Batch files Posted by 7dk2h4md720ih on Thu Mar 4th 2004 at 3:56pm
7dk2h4md720ih
1976 posts
Posted 2004-03-04 3:56pm
1976 posts 198 snarkmarks Registered: Oct 9th 2001
Orph if you name it "filename.bat" including the quotes you won't get a problem. And obviously select "all files" in the "save as type" menu.
Re: Batch files Posted by Orpheus on Thu Mar 4th 2004 at 3:58pm
Orpheus
13860 posts
Posted 2004-03-04 3:58pm
Orpheus
member
13860 posts 2024 snarkmarks Registered: Aug 26th 2001 Occupation: Long Haul Trucking Location: Long Oklahoma - USA
Alien_Sniper said:
Orph if you name it "filename.bat" including the quotes you won't get a problem.
so.. i am wrong again.. want me to remove the reply.. no biggie ..

i just tell people what i had to resort to.. for some reason, my XP liked hammer, when others had issues, but hated my batch files, when no one else did..

so sue me :rolleyes:
Re: Batch files Posted by 7dk2h4md720ih on Thu Mar 4th 2004 at 4:12pm
7dk2h4md720ih
1976 posts
Posted 2004-03-04 4:12pm
1976 posts 198 snarkmarks Registered: Oct 9th 2001
I was only offering a solution to the problem you reported having Jon, no need to get defensive.
Re: Batch files Posted by Orpheus on Thu Mar 4th 2004 at 4:18pm
Orpheus
13860 posts
Posted 2004-03-04 4:18pm
Orpheus
member
13860 posts 2024 snarkmarks Registered: Aug 26th 2001 Occupation: Long Haul Trucking Location: Long Oklahoma - USA
Alien_Sniper said:
I was only offering a solution to the problem you reported having Jon, no need to get defensive.
i am not.. just trying to stay true to my promise.. i will not fight/argue here again.. if that means bowing out.. so be it..

besides.. i no longer map for HL 1 so its a redundant or rhetorical comment... basically moot.

i have found no use at this time for a batch file with the HL2 editor.. hammer compiles my basic rooms just fine.. and since i cannot at this time.. post comments about this taboo editor (as per lep) i see no real reason to ask anyone now.
Re: Batch files Posted by Koa on Thu Mar 4th 2004 at 5:27pm
Koa
27 posts
Posted 2004-03-04 5:27pm
Koa
member
27 posts 3 snarkmarks Registered: Feb 24th 2004
Maybe i better explain that Im not totally new to batch files......No, i wasnt having any problems making the bat file itself...I have a "basic" undertanding of what they are and what they can do. Its a pretty simple procedure.
However, when i try these commands suggested, i bascially get nothing. Its the getting it to do what i want it to, thats not working. I tried all the ways suggested and it just doesnt seem to work. But...OK....maybe Im making a mistake....
Here's what i did.....I opened a .txt file......typed in the commands.....

copy C:\\Mapping\\My Maps\\beta_1.bsp C:\\Program Files\\Steam\\SteamApps\\blah@blah.com\\team fortress classic\\tfc\\maps
(i also tried your mv command, Crono)

....and either saved it with the .bat exstension, or saved it as .txt and then changed the exstension to .bat. Thats all there is to it, right?

You guys pull this off in XP? You can successfully move files with that method described?
If so i dont know why it wont work for me... :confused:
Maybe my paths are too long?

Again, I wasnt looking to learn the proccess of creating batch files....its simple....i wanted to do a double click instend of a navigate directorys....copy...navigate...paste.
I thought a batch file would be the quick answer lol
So now i think the solution would be create some shortcuts and just do it the long way :smile:
After all the time all of you have spent reading this, I almost feel obligated though to learn them now lol....thanks guys
By the way....the reason i wanted to do this was because im trying to learn entities ive never played with before....or just testing something.....jumping between the editor and the game a lot. Its no big deal....Ill keep trying it until i get it, or just work around it.

PS. is there a command to keep th e process window open? so i can actually watch it fail to do what i want?
Re: Batch files Posted by Forceflow on Thu Mar 4th 2004 at 6:14pm
Forceflow
2420 posts
Posted 2004-03-04 6:14pm
2420 posts 451 snarkmarks Registered: Nov 6th 2003 Occupation: Engineering Student (CS) Location: Belgium
are you using those DOS-type dirs ?

There's a Powertoy for something like "open a command prompt here": http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp
Re: Batch files Posted by Crono on Thu Mar 4th 2004 at 7:16pm
Crono
6628 posts
Posted 2004-03-04 7:16pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
Okay, Orph, I was joking :smile: Secondly, to be honest, you just said half of what me and Fraggard said and then told Koa to look at what we said some more.
I thought it was funny. Anyway, no need to 'bow out' either, I was just kiddin' around.

okay, Koa, These are just Dos commands, you find a list of those and you're set.

[EDIT]
Oh, God, Sorry, I found out why it wasn't working for you .... you need quotes. here:

move "C:\\Mapping\\My Maps\\beta_1.bsp" "C:\\Program Files\\Steam\\SteamApps\\blah@blah.com\\team fortress classic\\tfc\\maps"

save that (changing what you need to) and it will work.

The spaces in "team fortress classic" were being ignored, so when it when to find the forlder "teamfortressclassic" it didn't exist. :smile: Anyway, that will work

By the way, the word move in the above mentioned line can be changed to:
cp
copy
mv

and it will either copy the file or move it. They all work. Seriously check out that site I posted on my other post, it has all this stuff and it takes like 5 minutes to reference the information.
[/EDIT]
Re: Batch files Posted by beer hunter on Thu Mar 4th 2004 at 8:09pm
beer hunter
281 posts
Posted 2004-03-04 8:09pm
281 posts 602 snarkmarks Registered: Jul 6th 2003 Occupation: Beer taster Location: The Pub
PS. is there a command to keep the process window open? so i can actually watch it fail to do what i want?
Stick "pause" without quotes at the end of the batch file as the very last line.

Its possible to make batch files a bit more useful by drag and dropping files onto them. Create a batch file with the following stuff in it -

@echo off
cls
echo.
echo.
echo Parameter passed is %1
echo.
pause

Create a desktop shortcut using that batch file and then drag and drop a file onto it, it'll display the file name that was passed to it. Long file names that are truncated to classic 8 character DOS file names will still use the long file name for any copy, move etc.

To use it in your batch file -
move %1 "C:\\Program Files\\Steam\\SteamApps\\blah@blah.com\\team fortress classic\\tfc\\maps"

You can also drop several files onto the batch file -
echo Parameters passed are %1 %2 %3 %4 %5 etc.

The batch files a useful little fella :smile:
Re: Batch files Posted by Koa on Fri Mar 5th 2004 at 3:58am
Koa
27 posts
Posted 2004-03-05 3:58am
Koa
member
27 posts 3 snarkmarks Registered: Feb 24th 2004
To Crono and the rest, thanks a million. It was definatly the qoutes. It was terribly nice of you to come back and correct it.

And beet hunter....thanks for those commands thats so cool. Yeah, I agree they can save a lot of time for repetative tasks. (which was the goal !! woot)

You guys made me smile lol.
Re: Batch files Posted by Gorbachev on Fri Mar 5th 2004 at 4:14am
Gorbachev
1569 posts
Posted 2004-03-05 4:14am
1569 posts 264 snarkmarks Registered: Dec 1st 2002 Location: Vancouver, BC, Canada
Batch files work fine in XP, been using them for over a year from different versions of compilers, reformats and the like. Quotes'll do you in during certain operations. Such as when I'm using DOS to create a folder it needs quotes, but when I'm just changing directory it doesn't need them. Which can lead to little problems if you don't keep it consistant. Also using a frontend for batch files is good too. I use Nemesis' Batch Compiler personally, but also use self-written ones at times too. It's all preference.
Re: Batch files Posted by Crono on Fri Mar 5th 2004 at 4:31am
Crono
6628 posts
Posted 2004-03-05 4:31am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
Gorb, shouldn't you be working on your dod tutorial? :biggrin:
Re: Batch files Posted by Gorbachev on Fri Mar 5th 2004 at 9:12pm
Gorbachev
1569 posts
Posted 2004-03-05 9:12pm
1569 posts 264 snarkmarks Registered: Dec 1st 2002 Location: Vancouver, BC, Canada
I forewarned it would take from now until spring break to finish them, I want to get them all done and tested before I post them all up.
Re: Batch files Posted by Crono on Fri Mar 5th 2004 at 10:08pm
Crono
6628 posts
Posted 2004-03-05 10:08pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
I know, I was kidding, kind of a "get back to work slave" joke.