Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help requested with making a batch file  (Read 16134 times)

0 Members and 1 Guest are viewing this topic.

AbbieDorr

    Topic Starter


    Greenhorn

    Help requested with making a batch file
    « on: July 25, 2009, 06:52:17 AM »
    Hey Guys
    I'm the proud owner of a JVC camera. I've been working on a Batch file to make a small and ultra simple renaming program. Since JVC makes .MOD files which nothing can pla, you can just rename them to .MPG no problems there... But here is the point. How do i create a command that renames all file's in the folder which are .MOD to let's say 'holiday 1.mpg' holiday 2.mpg'etc.? can anybody help me?
    « Last Edit: July 25, 2009, 09:40:04 AM by AbbieDorr »

    Salmon Trout

    • Guest
    Re: Help requested with making a batch file
    « Reply #1 on: July 25, 2009, 07:12:39 AM »
    You're the owner of camera and a girlfriend? Maybe you should rephrase that?

    AbbieDorr

      Topic Starter


      Greenhorn

      Re: Help requested with making a batch file
      « Reply #2 on: July 25, 2009, 07:13:46 AM »
      Bought her..... Hahahaha. Yeah sounds stupid...... English is not my language

      Salmon Trout

      • Guest
      Re: Help requested with making a batch file
      « Reply #3 on: July 25, 2009, 07:20:49 AM »
      Bought her..... Hahahaha. Yeah sounds stupid...... English is not my language

      In Western societies, the idea of the ownership by men of women is considered offensive, not funny.

      BatchFileBasics



        Hopeful

        Thanked: 18
        Re: Help requested with making a batch file
        « Reply #4 on: July 25, 2009, 09:06:52 AM »
        give him a break, it is the internetz.

        anywho.

        you can solve this with the 'ren' command, known as Rename

        Code: [Select]
        ren *.mod *.mpg
        i have tested this on some txt files to fle

        Code: [Select]
        C:\Documents and Settings\Owner\test>ren *.fle *.txt
         Volume in drive C is Hard Drive
         Volume Serial Number is 5006-5177

         Directory of C:\Documents and Settings\Owner\test

        07/25/2009  08:06 AM    <DIR>          .
        07/25/2009  08:06 AM    <DIR>          ..
        07/25/2009  08:03 AM                 4 blarg1.txt
        07/25/2009  08:03 AM                 4 blarg2.txt
        07/25/2009  08:03 AM                 4 blarg3.txt
        07/25/2009  08:03 AM                 4 blarg4.txt
                       4 File(s)             16 bytes
                       2 Dir(s)  23,233,605,632 bytes free
        When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

        AbbieDorr

          Topic Starter


          Greenhorn

          Re: Help requested with making a batch file
          « Reply #5 on: July 25, 2009, 09:45:58 AM »
          All right for every one who was disturbed by the first message i wrote. I'm Sorry! I didn't know that on the internet there is a 'no jokes'-rule. So i edited the first post.

          thanx BatchFileBasics, but i already got that but now i want to rename all files

          FROM                    TO
          MOV01.MOD   -->  Holiday01.MPG
          MOV02.MOD   -->  Holiday02.MPG
          MOV03.MOD   -->  Holiday03.MPG

          So i want to now the command line to type something (in this case holiday) in store it and then make a count commond so that all the files get a number with the stored name.....
          THNX

          Salmon Trout

          • Guest
          Re: Help requested with making a batch file
          « Reply #6 on: July 25, 2009, 10:05:44 AM »
          All right for every one who was disturbed by the first message i wrote. I'm Sorry! I didn't know that on the internet there is a 'no jokes'-rule. So i edited the first post.

          thanx BatchFileBasics, but i already got that but now i want to rename all files

          FROM                    TO
          MOV01.MOD   -->  Holiday01.MPG
          MOV02.MOD   -->  Holiday02.MPG
          MOV03.MOD   -->  Holiday03.MPG

          So i want to now the command line to type something (in this case holiday) in store it and then make a count commond so that all the files get a number with the stored name.....
          THNX


          That's better. There is not a "no jokes rule" on the Internet, however there is a human tendency to react to stupid and/or sexist jokes.

          Nrename.bat

          Code: [Select]
          @echo off
          setlocal enabledelayedexpansion
          echo Rename files in numbered series
          echo Usage: Nrename filemask "prefix" "start number" "extension"
          if "%1"=="" goto end
          set flmask=%1
          set prefix=%~2
          set start=1%~3
          set suffix=%~4

          if not exist "%flmask%" (
          echo No files found!
          goto end
          )

          set nr=%start%
          for /f "delims=" %%F in ('dir /b /a-d /on %flmask%') do (
          set oldname=%%~nxF
          set numfigs=!nr:~1!
          set newname=%prefix%!numfigs!%suffix%
          if !nr! equ %start% echo !oldname! -^> !newname!
          set /a nr+=1
          )

          echo %oldname% -^> %newname%

          set /p go="Proceed (y/n) ? "
          if /i "%go%"=="n" goto end
          echo.
          set nr=%start%
          for /f "delims=" %%F in ('dir /b /a-d /on %flmask%') do (
          set oldname=%%~nxF
          set numfigs=!nr:~1!
          set newname=%prefix%!numfigs!%suffix%
          echo !oldname! -^> !newname!
          ren "!oldname!" "!newname!"
          set /a nr+=1
          )
          :end


          usage:

          Nrename<space>filemask<space>prefix<space>start-number-with-leading-zero(s)-if-wanted<space>extension

          use quotes optionally, (obligatory if any parameter has a space or spaces)

          Use a double quote to denote a blank parameter

           examples

          Code: [Select]
          Nrename *.mod holiday 01 .mpg
          Code: [Select]
          Nrename *.mod "holiday movie" 001 .mpg
          Code: [Select]
          Nrename *.txt "" 001 ""
          Code: [Select]
          Nrename *.* "" 0001 ".file"


          Contents of folder S:\Test

          Code: [Select]
          MOV01.mod
          MOV02.mod
          MOV03.mod
          MOV04.mod
          MOV05.mod
          MOV06.mod
          MOV07.mod
          MOV08.mod
          MOV09.mod
          MOV10.mod
          MOV11.mod
          MOV12.mod
          MOV13.mod
          MOV14.mod
          MOV15.mod
          MOV16.mod

          Run batch file

          Code: [Select]
          S:\Test\>Nrename *.mod Holiday 01 .mpg
          Rename files in numbered series
          Usage: Nrename filemask "prefix" "start number" "extension"
          MOV01.mod -> Holiday01.mpg
          MOV16.mod -> Holiday16.mpg
          Proceed (y/n) ? y

          MOV01.mod -> Holiday01.mpg
          MOV02.mod -> Holiday02.mpg
          MOV03.mod -> Holiday03.mpg
          MOV04.mod -> Holiday04.mpg
          MOV05.mod -> Holiday05.mpg
          MOV06.mod -> Holiday06.mpg
          MOV07.mod -> Holiday07.mpg
          MOV08.mod -> Holiday08.mpg
          MOV09.mod -> Holiday09.mpg
          MOV10.mod -> Holiday10.mpg
          MOV11.mod -> Holiday11.mpg
          MOV12.mod -> Holiday12.mpg
          MOV13.mod -> Holiday13.mpg
          MOV14.mod -> Holiday14.mpg
          MOV15.mod -> Holiday15.mpg
          MOV16.mod -> Holiday16.mpg

          « Last Edit: July 25, 2009, 10:38:00 AM by Salmon Trout »

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Help requested with making a batch file
          « Reply #7 on: July 25, 2009, 10:10:37 AM »
          I thought it was funny, if only because it was a silly slip-up.

          Kid of like that saying, a freudian slip is when you say one thing and mean your mother.
          I was trying to dereference Null Pointers before it was cool.

          Quantos



            Guru
          • Veni, Vidi, Vici
          • Thanked: 170
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Guru
          • OS: Linux variant
          Re: Help requested with making a batch file
          « Reply #8 on: July 25, 2009, 10:37:12 AM »
          In Western societies, the idea of the ownership by men of women is considered offensive, not funny.


          It is so funny.  The people that find it offensive are just whipped is all.
          Evil is an exact science.

          Salmon Trout

          • Guest
          Re: Help requested with making a batch file
          « Reply #9 on: July 25, 2009, 10:38:38 AM »
          It is so funny.  The people that find it offensive are just whipped is all.

          Are you aged about 13?

          Quantos



            Guru
          • Veni, Vidi, Vici
          • Thanked: 170
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Guru
          • OS: Linux variant
          Re: Help requested with making a batch file
          « Reply #10 on: July 25, 2009, 10:39:02 AM »
          I thought it was funny, if only because it was a silly slip-up.

          Kid of like that saying, a freudian slip is when you say one thing and mean your mother.

          I made a Freudian slip once.  I was out at a nice dinner with my wife and friends one night.  I meant to ask my wife to please pass the salt and pepper, but what came out was "You old hag, you screwed up my life."
          Evil is an exact science.

          Quantos



            Guru
          • Veni, Vidi, Vici
          • Thanked: 170
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Guru
          • OS: Linux variant
          Re: Help requested with making a batch file
          « Reply #11 on: July 25, 2009, 10:40:01 AM »
          Are you aged about 13?


          No, I'm a 42 year old bitter divorcee.
          Evil is an exact science.

          Salmon Trout

          • Guest
          Re: Help requested with making a batch file
          « Reply #12 on: July 25, 2009, 10:43:24 AM »
          No, I'm a 42 year old bitter divorcee.

          I am a divorcee too, but I reckon it takes 2. However, we're getting a bit OT.

          AbbieDorr

            Topic Starter


            Greenhorn

            Re: Help requested with making a batch file
            « Reply #13 on: July 25, 2009, 12:24:35 PM »
            Hello Salmon
            I think there is a problem cause it starts up and shuts down again..... Is it a problem if i'm using Vista?

            Salmon Trout

            • Guest
            Re: Help requested with making a batch file
            « Reply #14 on: July 25, 2009, 12:30:10 PM »
            Are you supplying it with the right number of parameters, as described above?

            Are you running it in the right folder?



            AbbieDorr

              Topic Starter


              Greenhorn

              Re: Help requested with making a batch file
              « Reply #15 on: July 25, 2009, 01:32:49 PM »
              I have copied the program and put it in a bat file, nothing else done. When i double click it, it opens and shuts down immediately

              billrich

              • Guest
              Re: Help requested with making a batch file
              « Reply #16 on: July 25, 2009, 01:35:09 PM »
               AbbieDorr  wrote
              <<<"I'm the proud owner of a JVC camera. I've been working on a Batch file to make a small and ultra simple renaming program. Since JVC makes .MOD files which nothing can play, you can just rename them to .MPG no problems there. But here is the point. How do I create a command that renames all file's in the folder which are .MOD to let's  say 'holiday 1.mpg' holiday 2.mpg'etc.? can anybody help me?">>>



              Renaming the .mod extention does not change the mod format.  The mod format will still not play.  There are many conversion programs on the internet to convert mod  to a format that will play with most players.

              Google [ mod to wmv ]


              http://www.modconverter.net/mod-to-wmv.html

              AbbieDorr

                Topic Starter


                Greenhorn

                Re: Help requested with making a batch file
                « Reply #17 on: July 25, 2009, 01:37:19 PM »
                If i do it like this (MOD rename to MPG) then i can edit the all the movie to a complete movie which i then can save as Avi (my home cinema set can not play wmv)

                Salmon Trout

                • Guest
                Re: Help requested with making a batch file
                « Reply #18 on: July 25, 2009, 01:40:33 PM »
                I have copied the program and put it in a bat file, nothing else done. When i double click it, it opens and shuts down immediately

                Double click no good.

                You need to

                1. Place the batch file either:

                   in the folder where the MOD files are

                   OR

                   in a folder on your PATH e.g. C:\Windows

                2. You then need to open a command window in that folder (where the MOD files are) and type at the prompt:

                    Nrename<space>filemask<space>prefix<space>start-number-with-leading-zero(s)-if-wanted<space>extension

                Read my earlier post for the details.

                billrich

                • Guest
                Re: Help requested with making a batch file
                « Reply #19 on: July 25, 2009, 02:59:28 PM »
                If I do it like this (MOD rename to MPG) then I can edit the all the movie to a complete movie which i then can save as Avi (my home cinema set can not play wmv)

                Go slowly.  Do the rename at the command line of only one file.  And then see if  you can edit and convert the format to avi.

                The conversion programs will convert to any format you need.

                Good luck

                Salmon Trout

                • Guest
                Re: Help requested with making a batch file
                « Reply #20 on: July 25, 2009, 03:46:27 PM »
                Go slowly [etc]

                .MOD files are JVC's implementation of MPEG-2 transport streams, similar to a VOB file on a DVD or the M2T files used on Sony hard drive camcorders. As with VOBs and M2Ts, you don't actually need to convert the files in order to make them playable / convertable on your computer, you can simply change the extension to .mpg. The OP has already discovered this, as he wrote earlier.


                billrich

                • Guest
                Re: Help requested with making a batch file
                « Reply #21 on: July 25, 2009, 04:16:36 PM »
                ... "you can simply change the extension to .mpg. The OP has already discovered this, as he wrote earlier."



                Then why does AbbieDorr  mention a conversion to AVI?

                Salmon Trout

                • Guest
                Re: Help requested with making a batch file
                « Reply #22 on: July 25, 2009, 04:27:30 PM »
                Quote
                Then why does AbbieDorr  mention a conversion to AVI?

                He wants to rename the MOD files to mpg so that his avi converter/merge program can read them. His home cinema setup can play avis.


                billrich

                • Guest
                Re: Help requested with making a batch file
                « Reply #23 on: July 25, 2009, 05:45:30 PM »
                Did AbbieDorr get the MOD rename to MPG program to work?

                I still believe a direct conversion from mod to avi is the best method.

                If the rename from MOD to MPG does not work,  then  AbbieDorr should try the direct conversion from mod to avi.

                I'm sorry, your approach is correct.  Carry on Private.  I'll be in the area all day.

                "MOD to AVI converter
                MOD to AVI Converter is currently the best MOD to AVI converter. which can perfectly convert MOD video to AVI, MPEG, WMV, ASF, VCD, SVCD, etc.

                Note: once you can not directly convert MOD to AVI, just change MOD file extention to *.MPG first, then use this MOD to AVI converter."


                http://www.modconverter.net/mod-to-avi.html

                Salmon Trout

                • Guest
                Re: Help requested with making a batch file
                « Reply #24 on: July 25, 2009, 06:10:09 PM »
                Quote
                MOD to AVI Converter

                Unfortunately it costs $34.95, whereas there are free alternatives like VirtualDub (with mpeg plugin) or VirtualDub-mpeg2 (which reads mpeg natively)

                gh0std0g74



                  Apprentice

                  Thanked: 37
                  Re: Help requested with making a batch file
                  « Reply #25 on: July 25, 2009, 06:30:08 PM »
                  you can try this vbscript

                  Code: [Select]
                  Set objFS = CreateObject("Scripting.FileSystemObject")
                  strFolder = "c:\test"
                  Set objFolder = objFS.GetFolder(strFolder)
                  count=0
                  For Each strFile In objFolder.Files
                  strExtension = objFS.GetExtensionName(strFile)
                  If strExtension = "MOD" Then
                      count=count+1
                  strNewName = "Holiday_"& count & ".MPG"
                  strFile.Name = strNewName
                  End If
                  Next

                  save as myrename.vbs and on command line
                  Code: [Select]
                  c:\test> cscript /nologo myrename.vbs

                  billrich

                  • Guest
                  Re: Help requested with making a batch file
                  « Reply #26 on: July 25, 2009, 07:26:55 PM »
                  C:\>type  mpgname.bat
                  REM  Usage: mpgname 4 ( one more than number of files )

                  Code: [Select]
                  @echo off
                  set /a c=0
                  :begin

                  set /a c+=1
                  if %c% EQU %1  goto end

                  ren mov%c%.mod    Holiday%c%.MPG
                  REM Be careful with ren. Use copy unitil certain of the code


                  goto begin

                  :end
                  dir /b  Hol*.mpg

                  Output:

                  C:\>mpgname.bat  4

                  C:\>REM  Usage: mpgname 4 ( one more than number of files )

                  C:\>dir /b Hol*
                  Holiday1.MPG
                  Holiday2.MPG
                  Holiday3.MPG
                  « Last Edit: July 26, 2009, 06:04:10 AM by billrich »

                  Quantos



                    Guru
                  • Veni, Vidi, Vici
                  • Thanked: 170
                    • Yes
                    • Yes
                  • Computer: Specs
                  • Experience: Guru
                  • OS: Linux variant
                  Re: Help requested with making a batch file
                  « Reply #27 on: July 25, 2009, 07:30:31 PM »
                  Try VideoSpiritLite, it's one that Broni just posted about in This Thread.
                  Evil is an exact science.

                  gh0std0g74



                    Apprentice

                    Thanked: 37
                    Re: Help requested with making a batch file
                    « Reply #28 on: July 25, 2009, 10:43:07 PM »
                    C:\>type  mpgname.bat
                    REM  Usage: mpgname 4 ( one more than number of files )

                    Code: [Select]
                    @echo off
                    set /a c=0
                    :begin

                    set /a c+=1
                    if %c% EQU %1  goto end

                    ren mov%c%.mod    Holiday%c%.MPG

                    goto begin

                    :end
                    type  Hol*.mpg

                    Output:

                    C:\>mpgname.bat  4

                    C:\>REM  Usage: mpgname 4 ( one more than number of files )

                    Holiday1.MPG


                    hello

                    Holiday2.MPG


                    hello

                    Holiday3.MPG


                    hello

                    C:\>

                    what kind of file names do you have in order to test your batch script above?

                    billrich

                    • Guest
                    Re: Help requested with making a batch file
                    « Reply #29 on: July 26, 2009, 04:58:31 AM »
                    what kind of file names do you have in order to test your batch script above?
                    Ghost:
                    We used the same file names used by Abbie Dorr, the original poster.


                    REM  Usage: mpgname 4 ( one more than number of files )

                    Code: [Select]
                    @echo off

                    set /a c=0
                    :start

                    set /a c+=1
                    if %c% EQU %1 set /a c=0 && goto  begin

                    echo hello > mov%c%.mod
                    goto start


                    :begin

                    set /a c+=1
                    if %c% EQU %1  goto end

                    ren mov%c%.mod    Holiday%c%.MPG
                    REM Be careful with ren. Use copy unitil certain of the code

                    goto begin

                    :end
                    dir /b  Hol*.mpg

                    Output:
                    C:\>mpgname.bat  4

                    C:\>REM  Usage: mpgname 4 ( one more than number of files )

                    C:\>dir /b Hol*
                    Holiday1.MPG
                    Holiday2.MPG
                    Holiday3.MPG

                    Be very careful with erase.  The following is before a second or third test. Use on test files only
                    C:\>erase Hol*.mpg

                    C:\>
                    « Last Edit: July 26, 2009, 06:02:35 AM by billrich »

                    Salmon Trout

                    • Guest
                    Re: Help requested with making a batch file
                    « Reply #30 on: July 26, 2009, 05:18:24 AM »
                    Quote
                    one more than number of files

                    I do not see why it is necessary to do this.

                    gh0std0g74



                      Apprentice

                      Thanked: 37
                      Re: Help requested with making a batch file
                      « Reply #31 on: July 26, 2009, 06:24:45 AM »
                      @billrich, what i mean is , how does your MOD file names look like?

                      billrich

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #32 on: July 26, 2009, 06:43:09 AM »
                      Bill wrote:

                      One more than number of files for command line argument.


                      I do not see why it is necessary to do this.


                      We don't know how many files Abbie Dorr, the original poster has to rename.

                      Abbie Dorr wrote:

                      "If I do it like this (MOD rename to MPG) then I can edit the all the movie to a complete movie which I then can save as Avi"

                      Salmon Trout

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #33 on: July 26, 2009, 06:47:05 AM »
                      We don't know how many files AbbieDorr, the original poster has to nename.

                      I know that!  ::) Did you see the words I quoted? I wanted to know why it is necessary to supply a parameter which is one more than the number of files. Why it can't be the same as the number of files?

                      billrich

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #34 on: July 26, 2009, 06:55:59 AM »
                      I know that!  ::) Did you see the words I quoted? I wanted to know why it is necessary to supply a parameter which is one more than the number of files. Why it can't be the same as the number of files? Anyway, why not count them in the batch? In fact, why bother counting them at all?


                      It was necessary because of the way I wrote my code.

                      Hey, this not production code and we are not paid.

                      My rename code works and is exactly what Abbie Dorr, the original poster ask for.   

                      Salmon Trout

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #35 on: July 26, 2009, 06:58:54 AM »
                      OK point taken

                      If you do this you can use the actual number from the command line

                      Code: [Select]
                      set /a c=-1

                      but I thought the OP wanted leading zeroes

                      billrich

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #36 on: July 26, 2009, 07:09:10 AM »
                      Code: [Select]
                      [quote author=Salmon Trout link=topic=88363.msg593414#msg593414 date=1248613134]
                      OK point taken

                      If you do this you can use the actual number from the command line

                       


                      "But I thought the OP wanted leading zeroes"

                      [/quote]

                      Abbie Dorr, the original poster can easily add leading zeros to the name. I see no advantage of leading zeros.   We need to leave insignificant details to  Abbie Dorr.  Abbie should be able to do some of the work.

                      Salmon Trout

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #37 on: July 26, 2009, 07:11:06 AM »
                      OK I agree.

                      billrich

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #38 on: July 26, 2009, 07:28:55 AM »
                      @billrich, what i mean is , how does your MOD file names look like?

                      My  test MOD file names looked like:

                      C:\>type mov10.mod
                      hello

                      C:\>type mov1.mod
                      hello

                      The files only contained "Hello."   Only the name was important.
                      « Last Edit: July 26, 2009, 08:40:35 AM by billrich »

                      billrich

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #39 on: July 26, 2009, 07:50:31 AM »
                      @billrich, what I mean is , how does your MOD file names look like?

                      To Ghost, Trout,  Abbie Dorr and All interested parties:
                      ( copy command used here to save mov**.mod file. ren used in next post. )

                      REM There are no leading zeros for 10 and above in file names.
                      REM  Usage: mpgname 13 ( one more than number of files )



                      REM  Usage: mpgname 13 ( one more than number of files )

                      Code: [Select]
                      @echo off

                      set /a c=0
                      :start

                      set /a c+=1
                      if %c% EQU %1 set /a c=0 && goto  begin

                       if %C%  LSS 10 echo hello > mov0%c%.mod
                      if %C%  GTR  9  echo hello > mov%c%.mod
                      goto start


                      :begin

                      set /a c+=1
                      if %c% EQU %1  goto end

                      REM if %C%  LSS 10 ren mov0%c%.mod    Holiday0%c%.MPG
                      REM if %C%  GTR  9 ren mov0%c%.mod    Holiday%c%.MPG
                      if %C%  LSS 10 copy mov0%c%.mod    Holiday0%c%.MPG

                      if %C%   GTR 10 copy mov%c%.mod    Holiday%c%.MPG

                      REM copy was used to save MOD files for Ghost

                      goto begin

                      :end
                      dir /b  mov*.mod
                      dir /b  Hol*.mpg

                      Output:

                      C:\>mpgname.bat 13

                      C:\>REM  Usage: mpgname 13 ( one more than number of files )
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                              1 file(s) copied.
                      mov01.mod
                      mov02.mod
                      mov03.mod
                      mov04.mod
                      mov05.mod
                      mov06.mod
                      mov07.mod
                      mov08.mod
                      mov09.mod
                      mov10.mod
                      mov11.mod
                      mov12.mod
                      Holiday01.MPG
                      Holiday02.MPG
                      Holiday03.MPG
                      Holiday04.MPG
                      Holiday05.MPG
                      Holiday06.MPG
                      Holiday07.MPG
                      Holiday08.MPG
                      Holiday09.MPG
                      Holiday11.MPG
                      Holiday12.MPG
                      C:\>
                      « Last Edit: July 26, 2009, 11:47:00 AM by billrich »

                      billrich

                      • Guest
                      Re: Help requested with making a batch file
                      « Reply #40 on: July 26, 2009, 12:07:03 PM »
                      The following code  uses ren and not copy.  The test  mov*.mod files were removed with ren. See the  test  mov*.mod files above post #39.

                      REM  Usage: mpgname 13 ( one more than number of files )

                      Code: [Select]
                      @echo off

                      setLocal EnableDelayedExpansion

                      set /a c=o
                      :begin

                      set /a c+=1
                      if %c% EQU %1  goto end

                      if %C%  LSS 10 ren mov0%c%.mod    Holiday0%c%.MPG
                      if %C%  GTR  9 ren mov%c%.mod    Holiday%c%.MPG

                      goto begin

                      :end
                      dir /b  Hol*.mpg

                      Output :

                      C:\> nomodname.bat 13

                      C:\>REM  Usage: mpgname 13 ( one more than number of files )
                      Holiday01.MPG
                      Holiday02.MPG
                      Holiday03.MPG
                      Holiday04.MPG
                      Holiday05.MPG
                      Holiday06.MPG
                      Holiday07.MPG
                      Holiday08.MPG
                      Holiday09.MPG
                      Holiday10.MPG
                      Holiday11.MPG
                      Holiday12.MPG
                      C:\>
                      « Last Edit: July 26, 2009, 12:40:43 PM by billrich »