Computing.Net > Forums > Disk Operating System > writing 2 commands in 1 line

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

writing 2 commands in 1 line

Reply to Message Icon

Name: CoolGie
Date: May 8, 2002 at 07:36:15 Pacific
Comment:

How do I write 2 commands in one line



Sponsored Link
Ads by Google

Response Number 1
Name: Ravi
Date: May 8, 2002 at 14:31:07 Pacific
Reply:

Can you explain which exact commands you are trying to write on same line?

- Ravi


0

Response Number 2
Name: Secret_Doom
Date: May 8, 2002 at 15:09:30 Pacific
Reply:

CoolGie, your question is not very clear...
Anyway, I'll give an example:

SET VAR1=abc
SET VAR2=def

The same thing can be done in one line:

SET VAR1=abc|SET VAR2=def

However, making such a thing is *not* recommended on a batch file. That's because the pipe creates a temporary file and writes to it the output from the first command, and that output will be used or not by the second one. This wastes time with no purpose at all. The time is very little, but may represent something big if we're talking about a batch file that has several loops.

This example will help you understanding that thing about saving the output:

:: These three lines
type file.txt > temp.dat
FIND "string" < temp.dat
del temp.dat
:: Make the same as this line
type file.txt |FIND "string"
:: The FIRST method is faster

In this example, using the pipe is not so bad, since it has some use there.

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 3
Name: CoolGie
Date: May 9, 2002 at 00:32:30 Pacific
Reply:

I want to cd(Change a directory) and run a PROIV exe file called, isout32.exe in one line using DOS. e.g cd c:\pro46\boots\bootstemp ; isout32 moji.out *.pro
This command works in LINUX, it changes the DIR to c:\pro46\boots and then in the same DIR isout32 creates an export file moji.out(saving all .pro files into moji.out file).

I hope this is clear enough.



0

Response Number 4
Name: Secret_Doom
Date: May 9, 2002 at 11:33:07 Pacific
Reply:

I see no point on making that on one line only, you'll be writing to a temporary file for nothing, but that's not the point. This should do it:

cd c:\pro46\boots\bootstemp | isout32 moji.out *.pro

Same as you're doing in LINUX, but instead of ';' use '|'.

-- Secret_Doom - Leonardo Pignataro --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 5
Name: schitzoid
Date: June 5, 2002 at 11:51:47 Pacific
Reply:

if you're using nt, "&" is the comand separator, as in:
at \\some_computer time cmd /c first_command&next_command
would schedule a task on remote computer to ran at set time, all on one line. to do it now on local computer obviously doesn't need the at command, just open prompt and type:
"do_me_1st.exe&do_me_next.exe"
I believe batch files require a double &&. Just play with first.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

How to find DOS Version. Parse time



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: writing 2 commands in 1 line

Mutiple commands in 1 For loop www.computing.net/answers/dos/mutiple-commands-in-1-for-loop/13810.html

How to create a log file in 1 line www.computing.net/answers/dos/how-to-create-a-log-file-in-1-line/12735.html

output www.computing.net/answers/dos/output/11734.html