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

Author Topic: system cannot find specified file  (Read 15898 times)

0 Members and 1 Guest are viewing this topic.

carlrowley1

    Topic Starter


    Hopeful

  • liverpool fc
    system cannot find specified file
    « on: July 21, 2008, 06:37:09 PM »
    hello there

    i have been trying this batch file example out , but what i keep getting is "system cannot find file specified" i have created i file called hope.txt  in c:\batch.files

    @echo off
    for /f "tokens=1-5 delims=/" %%d in ("%date%") do rename "hope.txt" %%e-%%f-%%g.txt

    if anyone could advise me were i am going wrong........thanks
    windows xp

    windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

    Laptop Toshiba.  L300/L300D series/windows vista home premium/
    2gb ram/32 bit/

    Windows 7 / home premium / 64 bit /3gb system ram /

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: system cannot find specified file
    « Reply #1 on: July 21, 2008, 07:04:41 PM »
    When defining your own delimiters, the space character is no longer the default. To add back the space, you need to define it as part of the delimiter pool.

    Code: [Select]
    @echo off
    for /f "tokens=1-4 delims=/ " %%d in ("%date%") do ren "hope.txt" %%e-%%f-%%g.txt

    FYI: %date% produces four parameters (ie: Mon 07/21/2008)

    Good luck. 8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    carlrowley1

      Topic Starter


      Hopeful

    • liverpool fc
      Re: system cannot find specified file
      « Reply #2 on: July 22, 2008, 12:55:45 AM »
      Quote
      When defining your own delimiters, the space character is no longer the default. To add back the space, you need to define it as part of the delimiter pool.

      as i am just learning not quite sure what you mean , this is my batch file as it is now, i have altered it to your example.


      for /f "tokens=1-4 delims=/ " %%d in ("%date%") do ren "hope.txt" %%e-%%f-%%g.txt


      windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

      Laptop Toshiba.  L300/L300D series/windows vista home premium/
      2gb ram/32 bit/

      Windows 7 / home premium / 64 bit /3gb system ram /

      Dias de verano

      • Guest
      Re: system cannot find specified file
      « Reply #3 on: July 22, 2008, 12:59:28 AM »
      illegal characters in filename?

      carlrowley1

        Topic Starter


        Hopeful

      • liverpool fc
        Re: system cannot find specified file
        « Reply #4 on: July 22, 2008, 01:25:40 AM »
        Quote
        illegal characters in filename?

        sorry still not sure were am going wrong

        @echo off
        for /f "tokens=1-4 delims=/ " %%d in ("%date%") do ren "hope.txt" %%e-%%f-%%g.txt
        pause

        windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

        Laptop Toshiba.  L300/L300D series/windows vista home premium/
        2gb ram/32 bit/

        Windows 7 / home premium / 64 bit /3gb system ram /

        Dias de verano

        • Guest
        Re: system cannot find specified file
        « Reply #5 on: July 22, 2008, 01:29:28 AM »
        does hope.txt exist where the script is looking for it?

        carlrowley1

          Topic Starter


          Hopeful

        • liverpool fc
          Re: system cannot find specified file
          « Reply #6 on: July 22, 2008, 01:42:17 AM »
          yes there both in the c:\batch.files directory
          windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

          Laptop Toshiba.  L300/L300D series/windows vista home premium/
          2gb ram/32 bit/

          Windows 7 / home premium / 64 bit /3gb system ram /

          Dusty



            Egghead

          • I could if she would, but she won't so I don't.
          • Thanked: 75
          • Experience: Beginner
          • OS: Windows XP
          Re: system cannot find specified file
          « Reply #7 on: July 22, 2008, 01:49:21 AM »
          Is C:\batch.files your default directory?

          One good deed is worth more than a year of good intentions.

          carlrowley1

            Topic Starter


            Hopeful

          • liverpool fc
            Re: system cannot find specified file
            « Reply #8 on: July 22, 2008, 01:53:09 AM »
            Quote
            Is C:\batch.files your default directory?

            not sure what you mean by default directory
            windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

            Laptop Toshiba.  L300/L300D series/windows vista home premium/
            2gb ram/32 bit/

            Windows 7 / home premium / 64 bit /3gb system ram /

            Dusty



              Egghead

            • I could if she would, but she won't so I don't.
            • Thanked: 75
            • Experience: Beginner
            • OS: Windows XP
            Re: system cannot find specified file
            « Reply #9 on: July 22, 2008, 02:21:00 AM »
            If your command prompt window shows just C:\> then that is your default directory and any executable in that directory will run if you just enter the name.  But if your command prompt is C:\>batch.files then C:\batch.files is your default directory and executables in C:\>batch.files will run if you just enter the executable name.

            So, if your default is C:\> and hope.txt is in C:\>batch.files\  the ren in your for statement will search for it in C:\> only and it will not be found.

            Try using .....ren "c:\batch.files\hope.txt"..... or cd to batch.files earlier.

            Good luck

            One good deed is worth more than a year of good intentions.

            carlrowley1

              Topic Starter


              Hopeful

            • liverpool fc
              Re: system cannot find specified file
              « Reply #10 on: July 22, 2008, 02:38:01 AM »
              Quote
              Try using .....ren "c:\batch.files\hope.txt"..... or cd to batch.files earlier.


              tryed that still comes op with carn't find specified file

              @echo off
              for /f "tokens=1-4 delims=/ " %%d in ("%date%") do ren "c:\ batch.files\hope.txt" %%e-%%f-%%g.txt
              pause


              windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

              Laptop Toshiba.  L300/L300D series/windows vista home premium/
              2gb ram/32 bit/

              Windows 7 / home premium / 64 bit /3gb system ram /

              Dias de verano

              • Guest
              Re: system cannot find specified file
              « Reply #11 on: July 22, 2008, 02:56:59 AM »
              1. You have put a space after the first slash: c:\ batch.file\hope.txt. Remove it & see if it now works.
              2. If not, what happens if you insert the word ECHO as shown below (What do you see on screen? - copy & paste it into your reply)
              Code: [Select]
              @echo off
              for /f "tokens=1-4 delims=/ " %%d in ("%date%") do ECHO ren "c:\ batch.files\hope.txt" %%e-%%f-%%g.txt
              pause

              carlrowley1

                Topic Starter


                Hopeful

              • liverpool fc
                Re: system cannot find specified file
                « Reply #12 on: July 22, 2008, 03:08:37 AM »
                I was just moving them to the default diectory so i now have "hope.txt"  and the batch file in there ....but i am still getting cannot find file

                @echo off
                for /f "tokens=1-4 delims=/ " %%d in ("%date%") do ren hope.txt %%e-%%f-%%g.txt
                pause
                windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

                Laptop Toshiba.  L300/L300D series/windows vista home premium/
                2gb ram/32 bit/

                Windows 7 / home premium / 64 bit /3gb system ram /

                Dias de verano

                • Guest
                Re: system cannot find specified file
                « Reply #13 on: July 22, 2008, 03:11:03 AM »
                Will you try what I asked in my last post?

                carlrowley1

                  Topic Starter


                  Hopeful

                • liverpool fc
                  Re: system cannot find specified file
                  « Reply #14 on: July 22, 2008, 03:37:22 AM »
                  ah right done what you said , when you click on the file now you will see
                  ren "c:\batch.files\hope.txt" o7-2008-.txt   so dias thats it   

                  just a silly thought but i thought it was renameing the file to  o7-2008-. i said to myself whats the point in that ....................but i see what it means know...........

                  not quite sure how you would use this, you still have your hope.txt file but also i have a batch file that when you click on it shows you ren "c:\batch.files\hope.txt" o7-2008-.txt
                  windowsXP professional sp3, Ram 512 , 1.30 gigahertz AMD Athlon, Maxtor 4r080L0 hard drive.

                  Laptop Toshiba.  L300/L300D series/windows vista home premium/
                  2gb ram/32 bit/

                  Windows 7 / home premium / 64 bit /3gb system ram /