Can anybody tell me what this DOS code does?

  • Thread starter Thread starter Academia
  • Start date Start date
A

Academia

Can anybody tell me what this code does?

The find should be after the | not on a separate line.

Should there be a space between the | and find ?

I think I understand the xcopy except for the c:\
Is the c:\ just a filler that is required but not used because of the /L

But what does ^| do?

I think the pipe sends the xcopy output to the find but what does the ^ do?



Thanks


for /F "delims=" %%a in ('xcopy /s /L /d:%MyDate% "%Source%\*.*" c:\ ^|
find ":"') do (
echo Decompressing "%%a"
)
 
Academia said:
Can anybody tell me what this code does?

The find should be after the | not on a separate line.

Should there be a space between the | and find ?

I think I understand the xcopy except for the c:\
Is the c:\ just a filler that is required but not used because of the /L

But what does ^| do?

I think the pipe sends the xcopy output to the find but what does the ^
do?



Thanks


for /F "delims=" %%a in ('xcopy /s /L /d:%MyDate% "%Source%\*.*" c:\ ^|
find ":"') do (
echo Decompressing "%%a"
)

This code comes out of my own kitchen, so here is a brief explanation.

For starts, it is not DOS code. DOS is an operating system sold by
Microsoft in about 1979. It could not possibly understand this stuff.
It is batch code running under WinXP or Win2000.

You can have a space after the | but you don't need one.

The "C:\" part is the destination for the "xcopy" command.
However, since I have used the /L switch, no copy action
will take place, so its actual value is of academic interest.

As you say, the | bar sends the output from the xcopy command
to the "find" command. Since the xcopy command is invoked
inside a "for" loop, the bar must be escaped with a carot
symbol, i.e. like so: ^|. This is advanced batch file stuff.

I now realise that I forgot to flag your original post for further
attention. If you still have problems with my batch file, please
return to the original thread.
 
For starts, it is not DOS code. DOS is an operating system sold by
Microsoft in about 1979. It could not possibly understand this stuff.
It is batch code running under WinXP or Win2000.

I knew you were going to post this. *Every* time someone posts a question
about DOS you have to jump in and correct them that there is no DOS.
*Every* time without fail.

Don <www.donwiss.com> (e-mail link at home page bottom).
 
I knew you were going to post this. *Every* time someone posts a question
about DOS you have to jump in and correct them that there is no DOS.
*Every* time without fail.

And, as a result, there is one more informed person out there now. I
don't see the problem. I was misinformed one time myself. :)
 
Don Wiss said:
I knew you were going to post this. *Every* time someone posts a question
about DOS you have to jump in and correct them that there is no DOS.
*Every* time without fail.

Don <www.donwiss.com> (e-mail link at home page bottom).

Feel free to call it DOS. Call it Linux if you like, CP/M if you prefer.
Unfortunately the code posted by the OP won't run on DOS, Linux
or CP/M.
 
Pegasus (MVP) said:
This code comes out of my own kitchen, so here is a brief explanation.

For starts, it is not DOS code. DOS is an operating system sold by
Microsoft in about 1979. It could not possibly understand this stuff.
It is batch code running under WinXP or Win2000.

To me "batch" means the app is run and all the output becomes available upon
completion. In contrast to interactive. With this definition all batch runs
need not be in the same language. For example if I wrote a vbs program to
delete a bunch if files then terninate; I'd call that a vbs batch program.
But a similer program that asks about each file, I'd call interactive.
Probably that has changed in the last 20 years or so, or maybe the
definition always varied with the platforms.

Is that how this is always refered to on the pc (Batch code) ? Makes sense
if it is more than a coincident that "batch" starts with "bat" and the file
extension is .bat.

Thanks for taking the time to point that out and for the info below.

I am having a problem but will decribe it in the other thread.

thanks again
 
Academia said:
To me "batch" means the app is run and all the output becomes available
upon completion. In contrast to interactive. With this definition all
batch runs need not be in the same language. For example if I wrote a vbs
program to delete a bunch if files then terninate; I'd call that a vbs
batch program. But a similer program that asks about each file, I'd call
interactive. Probably that has changed in the last 20 years or so, or
maybe the definition always varied with the platforms.

Is that how this is always refered to on the pc (Batch code) ? Makes
sense if it is more than a coincident that "batch" starts with "bat" and
the file extension is .bat.

Thanks for taking the time to point that out and for the info below.

I am having a problem but will decribe it in the other thread.

thanks again
 
Academia said:
To me "batch" means the app is run and all the output becomes available
upon completion. In contrast to interactive. With this definition all
batch runs need not be in the same language. For example if I wrote a vbs
program to delete a bunch if files then terninate; I'd call that a vbs
batch program. But a similer program that asks about each file, I'd call
interactive. Probably that has changed in the last 20 years or so, or
maybe the definition always varied with the platforms.

Is that how this is always refered to on the pc (Batch code) ? Makes
sense if it is more than a coincident that "batch" starts with "bat" and
the file extension is .bat.

Thanks for taking the time to point that out and for the info below.

I am having a problem but will decribe it in the other thread.

thanks again

From the linguistic point of view you're right: A batch process will
deal with a whole lot of items in one fell sweep, without further
interaction.

In the world of Windows things are a little different. I can think of
at least three different environments:
- A batch file: A collection of console commands such as copy,
delete, cd that execute in a non-GUI environment and that may
or may not ask the user for further input. Input to a batch file
is via the console, output is to the console. A batch file may
invoke a GUI application. Batch files have a .bat or a .cmd
extension.
- A VB Script file. A collection of VB commands that are
interpreted by cscript.exe or wscript.exe. Some VB Script
code executes in a console environment, some in a GUI
environment. Input can come via the console or via a dialog
box - same for output. VB Script files have an extension
of .vbs.
- A GUI. Such applications, e.g. MS Word, do not normally
interact at a console level, only with a graphical user interface.
Most GUIs are invoked with a .exe file.

In other words - batch files and VB Script files can and often
do ask the user for further input.
 
Thanks

Pegasus (MVP) said:
From the linguistic point of view you're right: A batch process will
deal with a whole lot of items in one fell sweep, without further
interaction.

In the world of Windows things are a little different. I can think of
at least three different environments:
- A batch file: A collection of console commands such as copy,
delete, cd that execute in a non-GUI environment and that may
or may not ask the user for further input. Input to a batch file
is via the console, output is to the console. A batch file may
invoke a GUI application. Batch files have a .bat or a .cmd
extension.
- A VB Script file. A collection of VB commands that are
interpreted by cscript.exe or wscript.exe. Some VB Script
code executes in a console environment, some in a GUI
environment. Input can come via the console or via a dialog
box - same for output. VB Script files have an extension
of .vbs.
- A GUI. Such applications, e.g. MS Word, do not normally
interact at a console level, only with a graphical user interface.
Most GUIs are invoked with a .exe file.

In other words - batch files and VB Script files can and often
do ask the user for further input.
 
Back
Top