Solved

Turn of the Read-Only flag of a file.

Posted on 1998-06-19
1
156 Views
Last Modified: 2010-04-04
Help
How can I change the "attrib" of a file? For example: I want to turn off the "read-only"-flag of LOGOW.SYS in my Windows-directory.
Thanx.
RoosieDB.
0
Comment
Question by:roosiedb
1 Comment
 

Accepted Solution

by:
edmoore earned 30 total points
ID: 1354406
You can use FileSetAttr(filename :string, attributes :TFileAttributes)

For example, to make logow.sys just a normal file, you would do:

FileSetAttr('c:\windows\logow.sys', 0);

And then to turn it back to normal, this:

FileSetAttr('c:\windows\logow.sys', faHidden or faReadOnly or faArchive);

Note:  the OR flags combine parameters, so the file is set to hidden, readonly and archive.  To find any more information, search for FileSetAttr in win32.hlp, but I think this should be OK - works for me!

Regards,

Ed Moore
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question