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

Author Topic: >> write command help needed  (Read 4261 times)

0 Members and 1 Guest are viewing this topic.

RandomGuy

    Topic Starter


    Rookie

    >> write command help needed
    « on: July 20, 2008, 08:19:28 AM »
    how would i code this to give "HELLOWORLD.txt" specific attributes such as hidden or read only?

    Code: [Select]
    @echo off
    >"c:\documents and settings\%user%\desktop\HELLOWORLD.txt" echo this is line one
    >>"c:\documents and settings\%user%\desktop\HELLOWORLD.txt" echo this is line two

    at the moment all i know is how to write stuff from batch, but not how to change the attributes of the files i write.  can somebody show me how?

    Dias de verano

    • Guest
    Re: >> write command help needed
    « Reply #1 on: July 20, 2008, 09:24:59 AM »
    You use the attrib command, and you can pass it up to 4 parameters which can be + or - r, a, s or h for readonly, archive, system, or hidden.

    thus attrib +r helloworld.txt makes that file read only and attrib +r +a -s -h helloworld.txt sets the readonly and archive bits, and unsets the system and hidden bits