Announcement

Collapse
No announcement yet.

.bat If Then statement

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • .bat If Then statement

    I need help with writing a batch script for

    if file newfile.txt exists then del "InDesignData.txt" ren "newfile.txt" "InDesignData.txt"

    Thanks in advance, Joe

  • #2
    Re: .bat If Then statement

    gives a lot of possibilities -- this should be quite adaptable to your needs:
    http://www.febooti.com/products/comm...statement.html
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: .bat If Then statement

      Solved ...

      Code:
      if not exist newfile.txt goto skip
      del "InDesignData.txt"
      ren "newfile.txt" "InDesignData.txt"
      :skip
      Last edited by biggles77; 7th September 2010, 14:04. Reason: Wrap script in CODE tag

      Comment


      • #4
        Re: .bat If Then statement

        Originally posted by jmituzas View Post
        Solved ...

        Code:
        if not exist newfile.txt goto skip
        del "InDesignData.txt"
        ren "newfile.txt" "InDesignData.txt"
        :skip
        or simply,
        Code:
        If exist "newfile.txt" MOVE /Y "newfile.txt" "InDesignData.txt"


        \Rems

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment

        Working...
        X