Batch File Help

the_tazinator

Are we there yet?
Joined
19 May 2002
Messages
177
I am trying to write a batch file that compares two files and if they are different, call another batch file. I have everything working except for one small glitch in the compare command. After the compare is done, it asks you if you want to compare any more files.

Is the any way to suppress this prompt or automatically answer "N" so that the batch file will continue?
 
I figured it out, I cant' splel thnisg rite, but now I have another problem.

I want to be able to rename a file based on the system time.

Something like: rename c:\file.txt <date>.txt

Any Ideas?

Thanks!
 
You could use now.exe from the Resource Kit tools. (Attached - unzip to system32, or anywhere else included in your path)

If you want the date the command would be something like

for /f "skip=1 tokens=1,2,3,5" %%a in ('now') do ren C:\file.txt %%a_%%b_%%c_%%d.txt


edit:

Just remembered the date command :cool:

for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do ren C:\file.txt %%a_%%b_%%c.txt
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back