View Full Version : Multiple batch commands on one line?
21-09-2004, 10:54 AM
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?).
echo off | if exist excess.work goto coffeebreak ;-)
Thanks - Spartacus
21-09-2004, 05:57 PM
21-09-2004, 07:24 PM
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
// for reason as above
// 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
22-09-2004, 10:07 AM
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";
22-09-2004, 12:15 PM
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
23-09-2004, 12:17 PM
> 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?
23-09-2004, 12:47 PM
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
23-09-2004, 01:43 PM
> 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:
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?
24-09-2004, 03:43 PM
Looks like Pipe is what you need - see here http://www.computerhope.com/issues/ch000177.htm
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.