13

Is there an easy way to open a file as read-only from Windows Explorer?

My inmediate interest is in a Microsoft Access file. I am doing some sanity checks in old MS Access databases and I see that their date is automatically updated when I open them. I don't like this, since it will look like all the old files have been modified today.

I am working with Windows XP.

Update: As Yoda said,

No. Try not. Do... or do not. There is no try.

In my case, it was "do not". I ended up copying the entire (big) folder tree to MyDocuments, and then opening all the databases from there.

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311

8 Answers8

30

I had the same problem on Windows 7. The above answer doesn't work for Windows 7 because the interface for file associations has changed. The good news is that Open as Read-Only is now a simpler process.

SHIFT + Right-Click or hit F10 -> click Open as Read-Only

wasif
  • 9,176
Cameron
  • 301
8

  • Open Windows Explorer.
  • Choose Folder Options from the View menu. (In some versions of Windows you choose Options from the View menu, or Folder Options from the Tools menu.) Windows displays the Folder Options (or just plain Options) dialog box.
  • Make sure the File Types tab is selected. (Click here to see a related figure.) In the list of Registered File Types, locate and select Microsoft Word Document. Click on the Edit button. Windows displays the Edit File Type dialog box. (Click here to see a related figure.)
  • Select the Open option in the Actions list.
  • Click on Advanced. The Edit File Type dialog box appears.
  • Click on Open in the Actions field.
  • Click on Edit. The Editing Action dialog box appears.
  • Select the contents of the Application Used to Perform Action box. (Click here to see a related figure.)
  • Press CTRL+C. This copies the contents of the Application Used to Perform Action box.
  • Click on Cancel.
  • Click the New button. Windows displays the New Action dialog box.
  • In the Action box, enter the name you want to appear in the shortcut menu. For instance, you could type Open Read-Only.
  • Position the insertion point in the Application Used to Perform Action box and press CTRL+V. The information you copied in step 8 is pasted into the box.
  • Select the Use DDE check box. The New Action dialog box expands.
  • In the DDE Message box, enter the following text: [FileOpen ("""%1"""),.ReadOnly]
  • In the Application box, enter this single word: WinWord.
  • In the Topic box, enter this single word: System.
  • Click Close or OK as necessary to dismiss all the dialog boxes.
  • admintech
    • 7,032
    5

    Another option if you are opening the file in an Office program is to follow the MS instructions.

    • Open the Office program you need
    • Click the Office button, and Open
    • Browse to the file you want to open and select it
    • On the Open button at the bottom, click the arrow and choose "Open as Read-Only"

    I tried this with Excel and it actually opened the file as read-only.

    When using the Shift+Right Click, the "Open as Read Only" option in Explorer seemed to have no effect. I do not see an "Open in Protected View" option.

    My whole reason for opening the file as read-only is so others can edit it while I have it open, so making the file read-only won't work.

    I also don't want to go through 18 steps to add an action, or edit the registry (not even sure I'm allowed to at work).

    I know this isn't technically opening it from Windows Explorer, but lots of people (like me) get here from Google and want to open something in an Office program.

    Nattgew
    • 1,155
    4

    Instead of Shift+Right-Click -> Open as Read Only, use Open in Protected View. Seems to do what's needed and prevents editing of the document. It should work for Word and Excel files.

    kenorb
    • 26,615
    3

    Found read-only option in program, did the following, but apparently did something wrong. Please let me know if you can correct.

    In Windows xp, Explorer 8 -Selected Tools -Folder Options -File types tab -Selected Microsoft Word Document -Clicked on Advanced [Edit File Type box came up] -In Actions box selected open as read-only -Clicked OK -Clicked Edit

    • Box entitled "Editing Action for Type Microsoft Word Docu . . . contained following information:

      Action: Open as Read-Only

      Application used to perform action: "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE" /h /n /dde

      DDE message: [AppShow][REM _DDE_ReadWriteOnSave][FileOpen .Name="%1",.Revert=0]

      Application: WinWord

      DDE application Not Running: [blank]

      Topic: System

    -Clicked OK all the way through.

    -Went to Explorer and right-clicked on a Word document, the read-only option was now in the menu, clicked on it with the following results:

    Error
    The command cannot be opened because a dialog box is open.  Click OK, and then close the dialog boxes to continue.
    
    Clicked ok
    
    Got second error
        Word experienced an error trying to open the file.
        Try these suggestions.
            *Check the file permissions for the document or drive.
            *Make sure there is sufficient memory or disk space.
            *Open the file with the text recovery converter.
            (F:\24th)
    

    -Clicked Show Help

    The file you tried to open was not found. It may be missing, in a different location, locked by another application, or unavailable due to file permissions. If you are sure the file exists but you cannot locate it using the Word File Open dialog, start Microsoft Windows Explorer and perform a search. If the search dialog returns a listing of your file, double-click on it to open it. If the file does not open, it is either corrupt, locked by another application, or is protected by file permissions.
    
    -Clicked OK
    -Filed opened, but not as read-only.
    
    -Tried another document, and this one opened immediately, but not as read-only.
    
    pungis
    • 31
    3

    This is what worked for me on Windows 7, after reading this and similar threads:

    For Word:

    • Edit your HKEY_CLASSES_ROOT\Word.Document.12\shell\OpenAsReadOnly\command keys such that the "%1" in both subentries is replaced by /dde, if it did not already say so
    • Again for Word2003 documents: Edit HKEY_CLASSES_ROOT\Word.Document.8\shell\OpenAsReadOnly\command like above
    • Import the following reg file or compare with your registry:

      Windows Registry Editor Version 5.00
      
      [HKEY_CLASSES_ROOT\Word.Document.12\shell\OpenAsReadOnly\ddeexec]
      @="[AppShow][REM _DDE_ReadWriteOnSave][FileOpen .Name="%1",.ReadOnly=1]"
      
      [HKEY_CLASSES_ROOT\Word.Document.12\shell\OpenAsReadOnly\ddeexec\Application]
      @="WinWord"
      
      [HKEY_CLASSES_ROOT\Word.Document.12\shell\OpenAsReadOnly\ddeexec\IfExec]
      @=""
      
      [HKEY_CLASSES_ROOT\Word.Document.12\shell\OpenAsReadOnly\ddeexec\Topic]
      @="System"`
      
      [HKEY_CLASSES_ROOT\Word.Document.8\shell\OpenAsReadOnly\ddeexec]
      @="[AppShow][REM _DDE_ReadWriteOnSave][FileOpen .Name=\"%1\",.ReadOnly=1]"
      
      [HKEY_CLASSES_ROOT\Word.Document.8\shell\OpenAsReadOnly\ddeexec\Application]
      @="WinWord"
      
      [HKEY_CLASSES_ROOT\Word.Document.8\shell\OpenAsReadOnly\ddeexec\IfExec]
      @=""
      
      [HKEY_CLASSES_ROOT\Word.Document.8\shell\OpenAsReadOnly\ddeexec\Topic]
      @="System"`
      

    For Excel:

    • Like word, make sure the commands under HKEY_CLASSES_ROOT\Excel.Sheet.12 and HKEY_CLASSES_ROOT\Excel.Sheet.8 have the /dde parameter (was the case for me already)
    • Import the following reg file or compare with your registry:

      Windows Registry Editor Version 5.00
      
      [HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\OpenAsReadOnly\ddeexec]
      @="[open("%1",,1)]"
      
      [HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\OpenAsReadOnly\ddeexec\application]
      @="Excel"
      
      [HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\OpenAsReadOnly\ddeexec\topic]
      @="system"
      
      [HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\OpenAsReadOnly\ddeexec]
      @="[open("%1",,1)]"
      
      [HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\OpenAsReadOnly\ddeexec\application]
      @="Excel"
      
      [HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\OpenAsReadOnly\ddeexec\topic]
      @="system"
      

    It should work similarly for the other Office types, but I did not try that.

    1

    I agree with music2myear, unless there are other users that prohibit this, the proper and easiest way would be to:

    • right click on the folder
    • go to properties
    • select read only
    • Apply to all sub folders.
    -1

    My problem is that the shift+right-click "Open as Read only" option wasn't working.
    I tried the registry edit solution here for windows 7:
    https://answers.microsoft.com/en-us/windows/forum/windows_7-files/files-not-opening-read-only/3a4242d4-bdfb-42a1-b6d2-a70775588101?page=1
    (Note: an answer in the linked thread also references this question)

    But I ended up solving this by changing the default value of the key
    (Note: Excel.Sheet.12 corresponds to xlsm files in my case, you will probably have to change it for other file types.)
    HKEY_CLASSES_ROOT\Excel.Sheet.12\shell\OpenAsReadOnly\command
    from
    "C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE" /h "%1"
    to
    "C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE" /r "%1"

    Explanation

    Per the docs, the /h command line switch opens word documents read-only (in sharepoint?), but for excel it's /r.

    Something I didn't try

    Repair ms office using the installer.

    Update 2020-01-17

    After reinstalling ms office, these registry keys were reset. As it turns out, my original response omitted an important step!
    Per the response I originally referred to:

    In the ddeexec key, you need to change the default value to: [open("%1",,1)]

    In the course of making the registry updates, I found a tool called RegScanner that made it so much easier to find the registry keys.
    Here are the search settings I used (screenshot of search):

    • Find String: Excel.*OpenAsReadOnly\\command
    • Matching: Registry item contains the specified regular expression
    • Look at: Keys
    • Check Scan the following base keys: and select:HKEY_CLASSES_ROOT

    You can double click on each search result to jump to that key in regedit.