Ok here is the question. I need to build a batch file that will search the c: drive for a given file, if that file exists I need it to delete it. Is it possible to do this with batch, or am I hitting its limitation? If its possible could someone please give me and example how the string should look.
Thank You For Your Help Everyone
Aaron
Page 1 of 1
Batch Program Help Multiple Commands in Batch
#1
Posted 30 November 2010 - 10:12 PM
Isaiah 54:17
No weapon that is formed against thee shall prosper; and every tongue [that] shall rise against thee in judgment thou shalt condemn. This [is] the heritage of the servants of the LORD, and their righteousness [is] of me, saith the LORD.
No weapon that is formed against thee shall prosper; and every tongue [that] shall rise against thee in judgment thou shalt condemn. This [is] the heritage of the servants of the LORD, and their righteousness [is] of me, saith the LORD.
#2
Posted 30 November 2010 - 11:11 PM
You want to make a batch file but did you try the DEL command ?
DEL /S can delete matching files from all sub-folders. Use very carefully. Type DEL /? to see all options.
DEL /S can delete matching files from all sub-folders. Use very carefully. Type DEL /? to see all options.
#3
Posted 30 November 2010 - 11:27 PM
YOU ARE MY HERO!!!!!!!!!!!! By chance you would know how to take all the results of my .bat file and export them into a single log.txt?
Isaiah 54:17
No weapon that is formed against thee shall prosper; and every tongue [that] shall rise against thee in judgment thou shalt condemn. This [is] the heritage of the servants of the LORD, and their righteousness [is] of me, saith the LORD.
No weapon that is formed against thee shall prosper; and every tongue [that] shall rise against thee in judgment thou shalt condemn. This [is] the heritage of the servants of the LORD, and their righteousness [is] of me, saith the LORD.
#4
Posted 01 December 2010 - 12:49 AM
In your batch file
Put > followed by logfile pathname to write output of command to new log file.
Put >> in the same way to append to an already existing log file.
For example,
Do this wherever needed. You can do fancy stuff too, like putting in date and time at the beginning of log :
Put > followed by logfile pathname to write output of command to new log file.
Put >> in the same way to append to an already existing log file.
For example,
DIR C: > c:\mylogfile.txt DIR C:\Windows >> c:\mylogfile.txt
Do this wherever needed. You can do fancy stuff too, like putting in date and time at the beginning of log :
SET LogFile=C:\mylogfile.txt ECHO. >> %LogFile% ECHO %Date% >> %LogFile% ECHO %Time% >> %LogFile% ECHO. >> %LogFile%
#5
Posted 03 December 2010 - 09:10 AM
Be aware that the del command will remove all files by that name, and only works against that name. If there are other files with the same name they'll be deleted as well. If you want to delete every case of a specific file (name and contents are both the same) you could get a bit of a safeguard by checking that the file size or date are the same.
Quod non mortiferum, fortiorem me facit.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.
I don't read minds. Please help everyone by answering any questions and reporting on the results of any instructions. Query any concerns and explain problems or complications.
Share this topic:
Page 1 of 1

Help

Back to top










