|
Answer» 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?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
|