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

Author Topic: *confirm* Hidden batch help??  (Read 19146 times)

0 Members and 1 Guest are viewing this topic.

nwlun

  • Guest
Re: Hidden batch help??
« Reply #15 on: June 08, 2007, 02:27:07 AM »
You can use XCOPY to copy a hidden file (with the /H switch).
Code: [Select]
for /f "tokens=*" %%1 in (c:\log.txt) do (xcopy "%%1" c:\haha.bat /h
   del "%%1")

tested it and still didnt work
File not Found

GuruGary



    Adviser
    Re: Hidden batch help??
    « Reply #16 on: June 08, 2007, 04:36:21 PM »
    But that same code does work when the file is not hidden?

    nwlun

    • Guest
    Re: Hidden batch help??
    « Reply #17 on: June 08, 2007, 06:28:41 PM »
    well it did work in not hidden mode  ::)

    so is it confirm or not confirm that it cannot be copy in hidden mode

    GuruGary



      Adviser
      Re: Hidden batch help??
      « Reply #18 on: June 08, 2007, 09:59:39 PM »
      XCOPY /H is designed to copy hidden files.  So yes, it should work.  Please confirm the following
      • You are using the XCOPY command
      • You are using the /H switch with XCOPY
      • The only thing you are changing is the hidden attribute on the file
      • You are using the exact same code with the test on hidden file and the regular file

      If all the above are true then there is something else going on.  Please confirm and post back with the exact code you are using.

      nwlun

      • Guest
      Re: Hidden batch help??
      « Reply #19 on: June 08, 2007, 11:42:10 PM »
      well yesterday i already manage to make it
      here the code

      @echo off
      echo *censored*
      echo hihi
      echo lol
      echo lalalla
      CD\
      dir c:\bat.bat /s /b > c:\log.txt
      for /f "tokens=*" %%1 in (c:\log.txt) do (xcopy /h "%%1" c:\haha.txt
                                                del "%%1")

      but i dont want to input the f=file, D=directory key
      i want to make it auto copy
       

      contrex

      • Guest
      Re: Hidden batch help??
      « Reply #20 on: June 09, 2007, 12:40:17 AM »

      but i dont want to input the f=file, D=directory key
      i want to make it auto copy
       

      Huh??? That means what?


      nwlun

      • Guest
      Re: Hidden batch help??
      « Reply #21 on: June 09, 2007, 01:01:17 AM »

      [/quote]

      Huh??? That means what?


      [/quote]

      u test it then u know

      GuruGary



        Adviser
        Re: Hidden batch help??
        « Reply #22 on: June 09, 2007, 01:07:22 AM »
        You are getting the File/Directory prompt because you are copying to a new file name, and neither a file or a directory with that name exist.  You can work around the issue by creating a dummy file to copy over.  Like:
        Code: [Select]
        dir c:\bat.bat /s /b > c:\log.txt
        echo.>c:\haha.txt
        for /f "tokens=*" %%1 in (c:\log.txt) do (xcopy "%%1" c:\haha.txt /h
           del "%%1")

        contrex

        • Guest
        Re: Hidden batch help??
        « Reply #23 on: June 09, 2007, 01:11:52 AM »
        I just saved that code to my C: drive as tryme.bat, and created a log.txt (an obviously needed step) and ran the batch and got this...

        Quote
        C:\>tryme
        *censored*
        hihi
        lol
        lalalla
        File Not Found

        I didn't get any "file/directory" prompt.

        nwlun, what is the purpose of all this? Why do you want a hidden batch file to copy itself?




        nwlun

        • Guest
        Re: Hidden batch help??
        « Reply #24 on: June 09, 2007, 02:10:33 AM »


        what is the purpose of all this?




        [/quote]

        no it just that few day ago suddenly i make a mistake in my batch where there i put and attrib +h to my batch then i reliaze that it cannot be copy

        it just weird that it cannot be copies that why i ask an expert from here whether it can be copy in hiden mode or not

        Fen_Li



          Beginner

        • G-Smart thing Smart
        • Thanked: 2
          Re: Hidden batch help??
          « Reply #25 on: June 09, 2007, 12:33:36 PM »
          I thing I can help you... ;D

          this is alternate way to copy file and work with hidden & system file..
          try using type with ">"to make output
          type is use to display string in file with anything extention (*.*)..

          ex:
          to copy "c:\whatever.exe" to "c:\folder\whatever.exe", this also work
          type "c:\whatever.exe">"c:\folder\whatever.exe"

          so, your code may like this:
          @echo off
          echo h**l
          echo hihi
          echo lol
          echo lalalla
          CD\
          dir c:\bat.bat /s /b > c:\log.txt
          for /f "tokens=*" %%1 in (c:\log.txt) do (
                type "%%1">c:\haha.txt
                del "%%1"
          )

           :) ;) :D ;D
          ..Still Newbie KID..

          nwlun

          • Guest
          Re: Hidden batch help??
          « Reply #26 on: June 09, 2007, 07:12:46 PM »
          I thing I can help you... ;D

          this is alternate way to copy file and work with hidden & system file..
          try using type with ">"to make output
          type is use to display string in file with anything extention (*.*)..

          ex:
          to copy "c:\whatever.exe" to "c:\folder\whatever.exe", this also work
          type "c:\whatever.exe">"c:\folder\whatever.exe"

          so, your code may like this:
          @echo off
          echo h**l
          echo hihi
          echo lol
          echo lalalla
          CD\
          dir c:\bat.bat /s /b > c:\log.txt
          for /f "tokens=*" %%1 in (c:\log.txt) do (
                type "%%1">c:\haha.txt
                del "%%1"
          )

           :) ;) :D ;D

          well did you try the batch in hidden mode
          well i guess u didnt
          anyway i just need a confirmation only
          thx to all the computer hope member that help me

          Fen_Li



            Beginner

          • G-Smart thing Smart
          • Thanked: 2
            Re: *confirm* Hidden batch help??
            « Reply #27 on: June 11, 2007, 09:59:58 AM »
            I'm not understand what you assume "Hidden Mode"
            if you assume "Copy File /w Hidden Attribute" it work fine...
             :(
            « Last Edit: June 11, 2007, 10:43:30 AM by Fen_Li »
            ..Still Newbie KID..

            contrex

            • Guest
            Re: *confirm* Hidden batch help??
            « Reply #28 on: June 11, 2007, 10:14:05 AM »
            I also am wondering what he means by "hidden mode"...


            2k_dummy



              Specialist
            • A word, once spoken, can never be recalled.
            • Thanked: 14
              Re: *confirm* Hidden batch help??
              « Reply #29 on: June 11, 2007, 11:01:29 AM »
              Why not just remove the hidden attribute and copy the file. If bat.bat is to be deleted:
              @echo off
              atrib -h c:\bat.bat
              copy c:\bat.bat c:\haha.bat
              del c:\bat.bat

              If haha.bat is to be hidden, add:

              attrib +h c:\haha.bat
              If you don't stand for something, you'll fall for anything.
              _______________________________________ ________
              BlackViper

              Software and utilities