Computing.Net > Forums > Programming > Adding typical Batch file features

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.

Adding typical Batch file features

Reply to Message Icon

Name: Eddieduce
Date: April 5, 2007 at 14:13:26 Pacific
OS: XP & Server 2003
CPU/Ram: x86 523MB NVRAM
Product: Gateway
Comment:

I have a batchfile that will backup specific mapped drive directory folders & its contents and want to add the creation of a log file, 'bakuplog' to a specific path showing time, date & PC used for backup. Will the log file history remain?

I attempted

ECHO %time% %date% >> C:\<my path>\backuplog.txt

.....but it did not work. I also need scripting that will show &verify that the file was, or not, created. Please help.


Eddieduce



Sponsored Link
Ads by Google

Response Number 1
Name: tonysathre
Date: April 5, 2007 at 15:13:36 Pacific
Reply:

I would put this as the first line in the script so it shows up at the top the log file:

echo Backup started at %time% on %date% on workstation %computername% > backuplog.txt

Then for the additional logging use the >> redirector to append the actual log to the file.

"Computer security." — Oxymoron


0

Response Number 2
Name: Eddieduce
Date: April 5, 2007 at 16:20:48 Pacific
Reply:

This is what I have written:

:Log Backup Start
echo %date% Backup started at %time% on
workstation %computername% > backuplog.txt

and

:Log Backup End
ECHO A log file is now being creted. . .
echo %date% Backup ended at %time% on
workstation %computername% >> backuplog.txt

Is this what you ment? I tried this, and also using a single simbol but it overwrites everything.


Eddieduce


0

Response Number 3
Name: Balkrah (by Vaughan Newton)
Date: April 5, 2007 at 23:13:41 Pacific
Reply:

Try this:

if not exist BackupLog.txt echo BackupLog file>BackupLog.txt
echo Creating Log file...
echo.>>BackupLog.txt
echo Date: %date% >>BackupLog.txt
echo Time: %time% >>BackupLog.txt
echo Computer Name: %computername% >>BackupLog.txt


0

Response Number 4
Name: Mechanix2Go
Date: April 6, 2007 at 00:23:12 Pacific
Reply:

".....but it did not work"

doesn't say much.

"ECHO %time% %date% >> C:\<my path>\backuplog.txt"

The only way that could fail is if the <my path> did not exist.



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 5
Name: Eddieduce
Date: April 6, 2007 at 09:26:56 Pacific
Reply:

I got it right now. The issue was that the <My Address> was incorrect.

How can I have the batch file verify and show me the results on weather the log file was correctly updated or not?

Eddieduce


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Enter data into field wit... flac file



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Adding typical Batch file features

DOS Batch File Commands www.computing.net/answers/programming/dos-batch-file-commands/14637.html

self destruct batch file ? www.computing.net/answers/programming/self-destruct-batch-file-/17288.html

Batch file: Adding to file names www.computing.net/answers/programming/batch-file-adding-to-file-names/9098.html