Computing.Net > Forums > Disk Operating System > Log of a batch file

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.

Log of a batch file

Reply to Message Icon

Name: Marzio
Date: May 22, 2003 at 06:59:02 Pacific
OS: Win98SE
CPU/Ram: P4 128MB
Comment:

Hi,
i have a batch file and i want to log all actions it do in a text file, how can i do?

help me pls



Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: May 22, 2003 at 14:03:21 Pacific
Reply:

In order for make the batch file display the commands it's executing, get out a "@echo off" line if it exists.

And if you want to redirect its output to a file, execute the batch file like this:

%comspec% /c MyBat.bat > logfile.txt

That will erase any previous information existant on logfile.txt. The following will just append the new info, preserving the original:

%comspec% /c MyBat.bat >> logfile.txt

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br

__________________________________________________


0

Response Number 2
Name: marzio
Date: May 23, 2003 at 02:45:08 Pacific
Reply:

my batch file is like this:
"
@echo off
CLS

echo :: Erases Recent Files List [OK]
DELTREE /Y %WINDIR%\RECENT\*.*

echo :: Erases Recent Microsoft Office Files List
DELTREE /Y %WINDIR%\applic~1\micros~1\office\filere~1\*.*

echo :: Erases Windows Temp Directory [OK]
DELTREE /Y %WINDIR%\TEMP\*.*
"

i have tryed also deleting "@echo off" , but your solution on my pc doesn't work,
it create an empty log file.


0

Response Number 3
Name: Secret_Doom
Date: May 24, 2003 at 14:27:40 Pacific
Reply:

You realize the string "MyBat.bat" on my last post was just an example, don't you? You should replace it by the filename of your own batch file.

Perhaps that's what's going wrong?

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Response Number 4
Name: Marzio
Date: May 26, 2003 at 01:17:06 Pacific
Reply:

Ok ok i'm a little distract ; )
But your solution don't show me the errors happened when the batch file don't find a file, can you tell me why?

oh, thanks



0

Sponsored Link
Ads by Google
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: Log of a batch file

Dos Commands in a batch file www.computing.net/answers/dos/dos-commands-in-a-batch-file/1258.html

checking a file date to execute a batch file www.computing.net/answers/dos/checking-a-file-date-to-execute-a-batch-file/1909.html

need a batch file www.computing.net/answers/dos/need-a-batch-file/15617.html