Forum Home
Press F1
 
Thread ID: 49489 2004-09-20 22:54:00 Multiple batch commands on one line? Spartacus (3313) Press F1
Post ID Timestamp Content User
274207 2004-09-20 22:54:00 I'm writing just a simple batch file and wondering if it's possible to put multiple commands on one line (ie - is there a line separator character?).

eg:
echo off | if exist excess.work goto coffeebreak ;-)

Thanks - Spartacus
Spartacus (3313)
274208 2004-09-21 05:57:00 Bump Mrs Bump (5694)
274209 2004-09-21 07:24:00 if textprocessor(word wrap) = NO then // no or not selected

answer = "yes"

//word wrap may break the command sequence giving unknown command message when batch file is run

elseif textprocessor(word wrap) = YES then // yes or selected

answer= "no"

// for reason as above

endif

// a batch file command sequence is read (by line) until a hidden char EOL (end of line) is read by the interpreting program. then reads the next line which if word wrap is on maybe part of the previous command sequence
beama (111)
274210 2004-09-21 22:07:00 textprocessor = notepad;
textprocessor.wordwrap = 0;

filetype = ".bat"

/* Beama, thanks for your reply, but what I really want to know is what (if any) the character is that will allow you to write say 3 separate commands all on one line. I used '|' in my example, but that doesn't work. */

reasons = "aesthetic";

mrsbump.value++

return;
Spartacus (3313)
274211 2004-09-22 00:15:00 are you tring to pipe the output from one command into another such as
dir | find date
thats the only way of I know of stringing commands in that manner
A hint on what you are tring to do with this bat file may help me and others answering this one
cheers
beama (111)
274212 2004-09-23 00:17:00 > A hint on what you are tring to do with this bat file may help me and others answering this one

I could, but it applies to any batch file - this one just happens to be renaming a large group of files, based on their extensions, and relocating them. No piping or otherwise recording of data.

As it stands, I have each command listed on a new line in notepad (just a run-of-the-mill batch file that works fine), but I would like (for purely aesthetic reasons in this case - no change in functionality) to have the entire batch file on just one line in notepad.

Is this possible?

Spartacus
Spartacus (3313)
274213 2004-09-23 00:47:00 yes i suppose so, no specail characters or the such just type it out but very hard to debug the code Ive seen javasript like this my reaction uck beama (111)
274214 2004-09-23 01:43:00 > yes i suppose so, no specail characters or the such
> just type it out but very hard to debug the code Ive
> seen javasript like this my reaction uck

It's not a practice that I commonly use - I agree that there's not much worse than untidy code when it comes to debugging, but in this simple case (it's under 20 commands) I'd like it all on the one line.

Have tried just typing out, but no go... For simplicity's sake I used this eg:

cd..
ren a*.txt b*.txt
copy *.txt backup

It works ok like this, but just putting it on one line doesn't... Does DOS not have a character that would make it see a line break where there isn't one?

Spartacus
Spartacus (3313)
274215 2004-09-24 03:43:00 Looks like Pipe is what you need - see here www.computerhope.com

Good luck

V...
Valerie (4740)
1