Done: Command line option to open a file read-only

Wishlists for new functionality and features.
Post Reply
Randy
Posts: 1
Joined: 19 Mar 2009 18:04

Done: Command line option to open a file read-only

Post by Randy » 19 Mar 2009 18:18

I'd like to be able to open files in a read-only mode so that HxD would not write them back if I made changes to them. The files are normal files on disk; they are likely not reed-only files to the Windows system.

Why do I want this? I use HxD to examine executables or other critical files from time to time, and I search for text, and I copy text sometimes, but sometimes my fingers slip and I step on a byte or two of the code I am looking at in HxD. I have done this without noticing it. I'd like to precondidition HxD to forbid me from making changes. HxD doesn't have to do anything special; I'd just like it to do nothing if I type inside the file area. I know that when I quit HxD will ask me if I want to save a changed file, and that I can at that time say "no", but sometimes I am in a hurry or not paying attention, and I have said "yes" inadvertently.

In day-to-day usage I would have a right-click explorer context menu entry (constructed by hand using the registry editor or indirectly using a tool like FileMenu Tools) that opened the file in HxD but provided this read-only option on the opening command line. I have one now for opening HxD as is. I have such a setup for Mirkes Tiny Hexer, but that developer recommends switching to you as he has ceased work. Both programs have been great finds and helps for me.

Thanks. (I looked but find no description of command line options.)

Maël
Site Admin
Posts: 1164
Joined: 12 Mar 2005 14:15

Re: Command line option to open a file read-only

Post by Maël » 19 Mar 2009 20:01

If you add HxD to the Windows context menu (see Options) it will automatically add an entry to open files as readonly.
The corresponding command line switch is /readonly (when this is specified all files passed as arguments are opened as readonly).

Guest

Re: Command line option to open a file read-only

Post by Guest » 19 Mar 2009 20:07

Thanks for the info, und so schnell. Can you point me to where I should have looked to find that out by myself?

Maël
Site Admin
Posts: 1164
Joined: 12 Mar 2005 14:15

Re: Command line option to open a file read-only

Post by Maël » 20 Mar 2009 01:49

The readonly command line parameter isn't documented as currently there is no help file for HxD. But the context-menu option could have been found by looking what options are offered in the options-dialog.

Post Reply