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

Author Topic: Batch File setting Attributes  (Read 5280 times)

0 Members and 1 Guest are viewing this topic.

tutsuo

    Topic Starter


    Starter

    Batch File setting Attributes
    « on: February 02, 2009, 02:08:46 AM »
    I'm not sure iv asked this correctly before because others never give the right answer(Even Google couldn't find it LOL).

    I'm wondering if a batch file can change the attribute(Read-only, Hidden and, Archive) of a file, and if so what is the command.

    I'm trying write a batch file that can set a normal file to a hidden attribute.

    This is what i have so far:

    " start view.exe /shtml view.html "

    Is there a way to add a command so it saves/changes it to a hidden attribute? Or write another batch to would run after that and change it to Hidden attribute.

    -Thanks in advance
    Tutsuo

    Dusty



      Egghead

    • I could if she would, but she won't so I don't.
    • Thanked: 75
    • Experience: Beginner
    • OS: Windows XP
    Re: Batch File setting Attributes
    « Reply #1 on: February 02, 2009, 02:17:09 AM »
    Welcome to the CH forums.

    Use the ATTRIB command to set attributes.  Enter ATTRIB/? in the command line to view parameters.

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

    tutsuo

      Topic Starter


      Starter

      Re: Batch File setting Attributes
      « Reply #2 on: February 02, 2009, 08:28:32 PM »
      i dont understand... so

      " start view.exe /shtml attrib/hidden view.html "

      ?

      Geek-9pm


        Mastermind
      • Geek After Dark
      • Thanked: 1026
        • Gekk9pm bnlog
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: Batch File setting Attributes
      « Reply #3 on: February 02, 2009, 08:48:12 PM »
      Quote
      start view.exe

      Is view a Windows program? It is not in my XP system.
      Why would you need to make the file hidden? If it is in a system area the average user is not going to see it. And if he is a super user he will find it anyway.

      tutsuo

        Topic Starter


        Starter

        Re: Batch File setting Attributes
        « Reply #4 on: February 02, 2009, 09:17:32 PM »
        the program is run from a usb flash drive. . .

        Dusty



          Egghead

        • I could if she would, but she won't so I don't.
        • Thanked: 75
        • Experience: Beginner
        • OS: Windows XP
        Re: Batch File setting Attributes
        « Reply #5 on: February 03, 2009, 12:31:52 AM »
        I don't understand either....  Here are the parameters (switches) for the Attrib command...
        Quote
        Displays or changes file attributes.

        ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
               [/S [/D]]

          +   Sets an attribute.
          -   Clears an attribute.
          R   Read-only file attribute.
          A   Archive file attribute.
          S   System file attribute.
          H   Hidden file attribute.
          [drive:][path][filename]
              Specifies a file or files for attrib to process.
          /S  Processes matching files in the current folder
              and all subfolders.
          /D  Processes folders as well.


        To hide a file use

        ATTRIB +H DRIVE\PATH\FILENAME   

        Example:
        attrib +h f:\view.exe

        or

        attrib +h f:\idontknow\whodoes.exe


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

        tutsuo

          Topic Starter


          Starter

          Re: Batch File setting Attributes
          « Reply #6 on: February 05, 2009, 11:45:35 AM »
          Hmm ill try that out.