[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Pipe output to a file with a batch file

Posted on 2007-12-04
4
Medium Priority
?
6,383 Views
Last Modified: 2010-01-12
I am setting up a batch job that will transfer files to several machines.  How do i send the output to a file so i can tell if any machines got missed?

i would echo the machine name, then i need to send the output of if it copied or not after it.
0
Comment
Question by:Fraser_Admin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
weareit earned 1000 total points
ID: 20404199
you can use the > charactor to redirect the output to a file.

> will overwrite
>> will append

i.e.

echo Todays date is > date.txt
date >> date.txt

-saige-
0
 
LVL 4

Assisted Solution

by:gabbadar
gabbadar earned 1000 total points
ID: 20404276
You can send the output of any command to file using the > or >> characters:
> - will create a new file
>> - will append to an existing file (or create if non existent)

So this would be a good start:




Echo Server1 >> c:\CopyLog.txt
xcopy \\server1\share\* \\my\destination >>c:\CopyLog.txt
Echo ---------- >> c:\CopyLog.txt
Echo Server2 >> c:\CopyLog.txt
xcopy \\server2\share\* \\my\destination >>c:\CopyLog.txt

Open in new window

0
 

Author Comment

by:Fraser_Admin
ID: 20404783
how do i send the date.  when i do date > output.txt it waits for me to press enter.  i also want to have the date/time combination?
0
 
LVL 4

Expert Comment

by:gabbadar
ID: 20405520
Rather than use the date/time program, use the variables:

echo %date% - %time%
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question