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 16056 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 /

                  Dias de verano

                  • Guest
                  Re: system cannot find specified file
                  « Reply #15 on: July 22, 2008, 03:46:56 AM »
                  Well, you can take the ECHO out.

                  I just created a folder called c:\batch.files and I put 1 file in it called hope.txt and then I ran this

                  ren "c:\batch.files\hope.txt" o7-2008-.txt

                  and now I have 1 file in there called o7-2008-.txt

                  so there is nothing wrong with the code.

                  Check that folder & file names match exactly and are all as they should be.



                  carlrowley1

                    Topic Starter


                    Hopeful

                  • liverpool fc
                    Re: system cannot find specified file
                    « Reply #16 on: July 22, 2008, 04:07:47 AM »
                    Quote
                    Check that folder & file names match exactly and are all as they should be.


                    I have just tryied this i have a folder called c:\ batch.files with hope.txt  in it  but when i run it i have the same problem
                    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 /

                    carlrowley1

                      Topic Starter


                      Hopeful

                    • liverpool fc
                      Re: system cannot find specified file
                      « Reply #17 on: July 22, 2008, 04:35:15 AM »
                      sorry dias got to rush

                      i will try this again on thursday or if i can SEND YOU A PRIVATE MESSAGE  .

                      CARN;T  figure out why i have these problems, as again i started with the example i copied, and thought that would work fine.

                      the very first code i mentioned was the one in the example, i seem to have tryed everything , but got no where as usual ....but i try again on thursday

                      just a recap

                      i have a folder called batch.files which is in the directory c:\batch.files  and i have a txt file called hope.txt in there.........................thanks
                      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 #18 on: July 22, 2008, 02:45:30 PM »
                      If this quote means what I think it means:
                      Quote
                      i have a folder called batch.files which is in the directory c:\batch.files  and i have a txt file called hope.txt in there
                      then your path to hope.txt is not C:\batch.files\ but C:\batch.files\batch.files\ so you would have to ...ren c:\batch.files\batch.files\hope.txt...

                      I have the impression that the file is not being found because it is not in the correct or specified path.

                      Try a simple dir C:\hope.txt and dir C:\batch.files\hope.txt and dir C:\batch.files\batch.files\hope.txt to find out which path it is in.

                      Edit:  Had another thought.  If your script has already been run and has worked then Hope.txt would have been renamed. look for a file with a date as the name.

                      « Last Edit: July 23, 2008, 07:58:51 PM by Dusty »
                      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 #19 on: July 24, 2008, 07:52:19 AM »



                        Quote
                        Try a simple dir C:\hope.txt and dir C:\batch.files\hope.txt and dir C:\batch.files\batch.files\hope.txt to find out which path it is in.

                        this is what i tryed

                        dir c:\hope.............file not found
                        dir c:\batch.files\hope.txt......file not found
                        dir c:\batch.files\batch.files\hope.txt......system cannot find file

                        this is the latest one i have tryed but it still cannot find the file

                        Quote
                        [Posted by: Sidewinder  Posted on: July 21, 2008, 07:04:41 PM 
                        Insert 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.


                        Code:
                        @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)

                         
                        /quote]







                        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 #20 on: July 24, 2008, 08:10:43 AM »
                        Based on your post, this should work but apparently doesn't:

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

                        Why does hope.txt have zero bytes? Is hope.txt a hidden, system or read-only file?

                         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 #21 on: July 24, 2008, 08:45:42 AM »
                          Quote
                          Why does hope.txt have zero bytes? Is hope.txt a hidden, system or read-only file?


                          i ve just put a few line lines in  there

                           i just created it for an example. so it carn't be a hidden , system file. or read only file
                          just don't know why it carn;t find it... its puzzeling me...because it seems so simple the hope.txt is 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 /

                          carlrowley1

                            Topic Starter


                            Hopeful

                          • liverpool fc
                            Re: system cannot find specified file
                            « Reply #22 on: July 24, 2008, 09:18:18 AM »
                            quote from sidewinder


                            Quote
                            Based on your post, this should work but apparently doesn't:


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


                            sorry guys this is what i should have been putting    :-[

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

                            had to add another .txt on the end, so sorry if i got you all confused...these things happen if you have just started learning........ :)   :-[
                            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 #23 on: July 24, 2008, 09:18:26 AM »
                            hope.txt is in the c:\batch.files directory

                            How do you know this?

                            Sidewinder



                              Guru

                              Thanked: 139
                            • Experience: Familiar
                            • OS: Windows 10
                            Re: system cannot find specified file
                            « Reply #24 on: July 24, 2008, 09:23:43 AM »
                            Quote
                            had to add another .txt on the end, so sorry if i got you all confused...these things happen if you have just started learning........

                            I'm a little slow on the uptake, so is the problem solved?

                            Hopefully waiting   ;)
                            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 #25 on: July 24, 2008, 09:26:39 AM »
                              yes problem solved.........thanks everyone.....until the next time
                              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 #26 on: July 24, 2008, 09:40:51 AM »
                              Quote
                              had to add another .txt on the end, so sorry if i got you all confused...these things happen if you have just started learning........

                              I'm a little slow on the uptake, so is the problem solved?

                              Hopefully waiting   ;)

                              Sidewinder, I doubt if carlrowley is going to answer that question, so perhaps I will have a stab.

                              There never was a problem. Or rather, there was, but it was in front of the keyboard, not behind it. The OP stated that he could not rename a file called "hope.txt". Despite questions such as these he continued to maintain that this file existed and was located in a certain folder:

                              Quote
                              Check that folder & file names match exactly and are all as they should be.

                              However, he finally stated that the file was actually called hope.txt.txt.

                              One can speculate about the reasons for this, and I suspect that it may have something to do with hidden file extensions in Windows Explorer. Anyway, we all got royally led up the garden path.




                              carlrowley1

                                Topic Starter


                                Hopeful

                              • liverpool fc
                                Re: system cannot find specified file
                                « Reply #27 on: July 24, 2008, 10:12:48 AM »
                                so basically if the file was just called "HOPE" it would have worked the first time because it automatically adds the .txt  , hope being a txt file


                                so there was a file called "hope.txt" but the computer is adding another .txt on when searching for it....thus comeing back as file not found
                                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 #28 on: July 24, 2008, 10:17:49 AM »
                                No. ""Basically" there was a file called hope.txt.txt. You seemed to think it was called hope.txt. The computer knew all along what it was called. It was you that didn't. You should uncheck "hide extensions for known file types" in Windows Explorer folder options to avoid any more "problems" like this one.
                                « Last Edit: July 24, 2008, 10:58:00 AM by Dias de verano »

                                carlrowley1

                                  Topic Starter


                                  Hopeful

                                • liverpool fc
                                  Re: system cannot find specified file
                                  « Reply #29 on: July 24, 2008, 11:21:26 AM »
                                  Quote
                                  You should uncheck "hide extensions for known file types" in Windows Explorer folder options to avoid any more "problems" like this one.

                                  thanks dias just done that,  works fine   :)
                                  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 #30 on: July 24, 2008, 11:29:01 AM »
                                  Quote
                                  Anyway, we all got royally led up the garden path

                                  Should have stopped to smell the roses.  ;D

                                  Quote
                                  You should uncheck "hide extensions for known file types" in Windows Explorer folder options to avoid any more "problems" like this one.

                                  Or have run a dir list on the directory and seen what the actual file names were instead of using a qualifier that did not exist.

                                  Sometimes the simplest things....
                                  The true sign of intelligence is not knowledge but imagination.

                                  -- Albert Einstein

                                  Dias de verano

                                  • Guest
                                  Re: system cannot find specified file
                                  « Reply #31 on: July 24, 2008, 11:33:59 AM »
                                  Sometimes the simplest things....

                                  Indeed.

                                  erobby



                                    Beginner

                                    • Experience: Experienced
                                    • OS: Linux variant
                                    Re: system cannot find specified file
                                    « Reply #32 on: July 24, 2008, 06:44:33 PM »
                                    Wow

                                    I was expecting to see something like this in the post

                                    set ydate=%date:~-4%
                                    set mdate=%date:~4,2%
                                    set ddate=%date:~7,2%

                                    ren hope.txt %mdate%%ydate%.txt