Batch File Help

Discussion in 'Windows Desktop Systems' started by the_tazinator, Nov 20, 2003.

  1. the_tazinator

    the_tazinator Are we there yet?

    Messages:
    177
    Location:
    In a house
    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?
     
  2. yoyo

    yoyo _________________

    Messages:
    1,557
    Can you use the fc command?
     
  3. the_tazinator

    the_tazinator Are we there yet?

    Messages:
    177
    Location:
    In a house
    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!
     
  4. yoyo

    yoyo _________________

    Messages:
    1,557
    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
     
  5. the_tazinator

    the_tazinator Are we there yet?

    Messages:
    177
    Location:
    In a house
    Thanks!

    I will give it a try.