Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
CoolGie, your question is not very clear...
Anyway, I'll give an example:SET VAR1=abc
SET VAR2=defThe 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 fasterIn 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

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.

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

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.

![]() |
How to find DOS Version.
|
Parse time
|

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