Shortcut to make something readonly/not readonly

6,990

Solution 1

Works under XP: Alt+Enter Alt+R Enter

Solution 2

attrib is what you're looking for:

attrib +r readonlyfile.txt
attrib -r writeablefile.txt

help attrib says:

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.
Share:
6,990
Peter Turner
Author by

Peter Turner

Faithful Catholic - Father of 5, Husband of 1 Programmer of cloudish things from Southern Wisconsin.

Updated on September 17, 2022

Comments

  • Peter Turner
    Peter Turner over 1 year

    Is there a windows (explorer) shortcut or non-mouse oriented command to make a toggle a given file's read only status?

  • Peter Turner
    Peter Turner about 14 years
    Good answer, though it made me revise my original question because I really wanted a windows explorer shortcut. I'm thinking one doesn't exist, but maybe someone knows of an shell extension or something.
  • heavyd
    heavyd about 14 years
    Perhaps using a combination of attrib and the Send To folder would solve your problem.
  • Joey
    Joey about 14 years
    You can also add a verb to the context menu which toggles it.
  • Dean Meehan
    Dean Meehan about 5 years
    Additionally confirmed to work under Windows 7
  • TheGeneral
    TheGeneral almost 3 years
    Continues to work under Windows 10.