cmd scripting

G

Guest

Hello,

I made a batch (.bat) file. That batch file includes:

echo hello > file.txt

There is a problem when running that batch file. When I run batch file in
cmd window, it runs and I see:

echo hello 1> file.txt

command line. But I didn't write that line in the batch file.


Why does it run like that? I have to write important batch file and it must
be a flawless.

Thanks...
 
J

Jon

Murat said:
Hello,

I made a batch (.bat) file. That batch file includes:

echo hello > file.txt

There is a problem when running that batch file. When I run batch file in
cmd window, it runs and I see:

echo hello 1> file.txt

command line. But I didn't write that line in the batch file.


Why does it run like that? I have to write important batch file and it
must
be a flawless.

Thanks...

1> and > mean the same here, both referring to standard output.

If it's the line repeating itself that bugs you, then you could add
@echo off
at the top of your batch file to stop the echo.


Jon
 
G

Guest

If it's the line repeating itself that bugs you, then you could add
@echo off

It's not important for me.

But it is important to be sure that 1> and > mean same. Is there any
document about this?

Thanks Jon.
 
J

Jon

Murat said:
It's not important for me.

But it is important to be sure that 1> and > mean same. Is there any
document about this?

Thanks Jon.

Perhaps someone else will chip in with an authorative documentation source.
Here's another site that says the same
http://www.robvanderwoude.com/index.html

You could easily confirm it yourself, by changing your batch file line
echo hello > file.txt
to
echo hello 1> file.txt

and observing that they do the same

Jon
 
T

Torgeir Bakken \(MVP\)

Murat said:
It's not important for me.

But it is important to be sure that 1> and > mean same. Is there any
document about this?
Hi,

In WinXP's Help and Support Center, search for "redirection operators"...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top