• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Batch File Help

the_tazinator

Are we there yet?
#1
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?
 

the_tazinator

Are we there yet?
#3
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!
 

yoyo

_________________
#4
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 posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies