batch file to save a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user1980
    New Member
    • Dec 2009
    • 112

    batch file to save a file

    I am new to writing batch files. I just know few commands....My problem is I have to open a text file and then save it with a different name ie; open a text file, 1.txt and then save as 2.txt.

    I could write commands to open the file and close the file but could not save it as a new file. I do not want to rename the file as it would not serve my purpose.
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    look up the "copy" command

    on the command line try copy /?

    Comment

    • user1980
      New Member
      • Dec 2009
      • 112

      #3
      thank you for the response..but it did not serve my purpose...
      please correct me if I am wrong,,is it just the word copy or copy /

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        in the command window type "copy /?" and it will tell you how to use the copy command.

        Comment

        • user1980
          New Member
          • Dec 2009
          • 112

          #5
          oh ok..thank you...i will try that

          Comment

          • user1980
            New Member
            • Dec 2009
            • 112

            #6
            hello there.. I did try but could not make it work..
            my main problem is I have to get rid of squares at the end of certain text lines, when I open my test file using word pad I can see the squares. But when I try to open it in notepad and save it.Then the square disappears when opened in word pad.

            thank you for your time..

            Comment

            • RedSon
              Recognized Expert Expert
              • Jan 2007
              • 4980

              #7
              That sounds like a character encoding issue, not a copy issue. You could try using the /B switch or the /V switch or both.

              Comment

              Working...