Computing.Net > Forums > Disk Operating System > Batch File Output Redirection?

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.

Batch File Output Redirection?

Reply to Message Icon

Name: Dim Smith
Date: March 7, 2000 at 19:00:12 Pacific
Comment:

I have written the batch program bellow and need help in redirecting the output the program puts up on screen into a log file as a permanet record.
Any help would be gratefuly appreciated thanks.

@ECHO OFF
IF %3==### GOTO PError
IF NOT %3==### GOTO PError
CLS
IF NOT EXIST %1\*.* GOTO SError
CHOICE Is the backup DESTINATION a root directory
IF ERRORLEVEL 2 GOTO Standard
IF ERRORLEVEL 1 GOTO Root

:Standard
IF NOT EXIST %2\*.* GOTO MakeDir
IF EXIST %2\*.* GOTO SkipMakeDir
:MakeDir
CLS
CHOICE The DESTINATION directory is invalid, do you want it created
IF ERRORLEVEL 2 GOTO DError
IF ERRORLEVEL 1 GOTO Continue
:Continue
CLS
MD %2
XCOPY %1 %2\%1 /E/I/F/-Y
IF ERRORLEVEL 4 GOTO DError
GOTO Complete
:SkipMakeDir
CLS
XCOPY %1 %2\%1 /E/I/F/-Y
IF ERRORLEVEL 4 GOTO DError
GOTO Complete

:Root
CLS
XCOPY %1 %2%1 /E/I/F/-Y
IF ERRORLEVEL 4 GOTO DError
GOTO Complete

:PError
ECHO *******************************************************************
ECHO * Too many Perameters,use only two i.e.Backup[Source Destination] *
ECHO *******************************************************************
GOTO END

:SError
ECHO *************************************************
ECHO * Invalid Source Dirctory Please Restart Backup *
ECHO *************************************************
GOTO END

:DError
ECHO *******************************************************
ECHO * Invalid Destination Directory Please Restart Backup *
ECHO *******************************************************
GOTO END

:complete
ECHO *******************
ECHO * Backup Complete *
ECHO *******************

:END



Sponsored Link
Ads by Google

Response Number 1
Name: unisol
Date: March 8, 2000 at 06:52:18 Pacific
Reply:

Don't you like
prog > logfile.txt
???


0
Reply to Message Icon

Related Posts

See More







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: Batch File Output Redirection?

What does >nul do in a batch file www.computing.net/answers/dos/what-does-nul-do-in-a-batch-file/198.html

Batch File Redirection www.computing.net/answers/dos/batch-file-redirection/1098.html

User log in date from a batch file www.computing.net/answers/dos/user-log-in-date-from-a-batch-file/7783.html