To solve a single line (provided that the current user has access to change the attributes of the mentioned file), here's how I do it:
Vb.net
Shell("attrib file.txt -r")
a negative sign means remove , and r is read-only. if you also want to remove other attributes, follow these steps:
Shell("attrib file.txt -r -s -h -a")
This will remove the Read-Only, System-File, Hidden, and Archive attributes.
if you want to return these attributes, here's how:
Shell("attrib file.txt +r +s +h +a")
order doesn't matter.
FROM#
Process.Start("cmd.exe", "attrib file.txt +r +s +h +a");
References
Ahmad Sep 13 '11 at 9:41 2011-09-13 09:41
source share