Clear Contents of a Log File using Batch Script
Posted: 13 Jan 2010 16:11
Hello,
I am trying to clear the contents of a log file app1.log which is being used by a server.
I am using windows 2003.
Following are the commands I tried so far.
command: echo on>app1.log
output: The process cannot access the file because it is being used by another process
command:type nul>app1.log
output: The process cannot access the file because it is being used by another process
command:type app1.log>NUL>app1.log
output: The process cannot access the file because it is being used by another process
I am able to open the file, select content,delete and save the file under same name - manually.
Can some one Please suggest how to put this in a batch script.
Thank You.
I am trying to clear the contents of a log file app1.log which is being used by a server.
I am using windows 2003.
Following are the commands I tried so far.
command: echo on>app1.log
output: The process cannot access the file because it is being used by another process
command:type nul>app1.log
output: The process cannot access the file because it is being used by another process
command:type app1.log>NUL>app1.log
output: The process cannot access the file because it is being used by another process
I am able to open the file, select content,delete and save the file under same name - manually.
Can some one Please suggest how to put this in a batch script.
Thank You.