Still the use of the option /R and /W at the beginning would allow the parsing just fine, as said, and IMHO it makes little sense to need to specify "read" for "getvalue", a program normally defaults to either "read" or "write" mode, in the case of offlinereg, due to the possible damages it can be done, it should default to "read" mode always, unless the /W (or "write") option is explicited.
Good points. However in my opinion the default (only?) option should be write for all commands that modify the target hive and read for all commands that read values. And ignore my previous suggestions as it would indeed be simpler to just get rid of the need for the read or write option I suggested. Any need for a backup of the target hive to be completed manually using a backup option that should be relatively easy for
Erwan.l to implement?
I would theorise that any current backups are rarely used, if at all? If I want one, I can take one using a copy command at the moment. The suggested manual backup option to OfflineReg would however make life easier.
In what scenario is anyone likely to execute a series of commands without the
nobackup option? Lets say for example that we run the following -
OfflineReg D:\PATH\System ControlSet001\A\B\C\D createkey
OfflineReg D:\PATH\System ControlSet001\Control setvalue "New Value" "New Value Data" 1
The first command will add the new key(s) to one hive, and the second will add the new key+value+data to a different hive. If we want to execute both commands on the same hive we would have to manually carry out similar steps to those automated by using the
nobackup option.
I would argue that it is far more likely that someone would be running the following instead, in order to write both commands to the same registry hive -
OfflineReg D:\PATH\System ControlSet001\A\B\C\D createkey " " nobackup
OfflineReg D:\PATH\System ControlSet001\Control setvalue "New Value" "New Value Data" 1 nobackup
Which at the moment would carry out six different operation. And that's not including the adding of the keys and data - its due to the create and renaming currently in use.
I personally only use the
nobackup option for all modifcation type commands as it saves me the hassle of manually deleting the old hive and replacing it with the new hive. The proposed writing directly to a hive and not automating the backup could now take the following form, directly writing to the target hive without any backups -
OfflineReg D:\PATH\System ControlSet001\A\B\C\D createkey
OfflineReg D:\PATH\System ControlSet001\Control setvalue "New Value" "New Value Data" 1
Much cleaner syntax in my opinion, with fixed positions of parameters still maintained if this makes it easier for
Erwan to code.
And if for some reason a backup is required, then using the proposed new commands -
OfflineReg D:\PATH\System D:\PATH\System.bak backup
OfflineReg D:\PATH\System ControlSet001\A\B\C\D createkey
OfflineReg D:\PATH\System ControlSet001\Control setvalue "New Value" "New Value Data" 1
And in what cases would a recursive switch be required? In regards to the deleting of keys with subkeys, the exisiting
deletekeys command completes this function just as easily as the following example might, without the need for any code changes -
OfflineReg /R D:\PATH\System ControlSet001\Control\MyKey deletekey
And a recursive parsing of keys would be a bloody nightmare in a large hive! I'm really not sure when this would be needed?
Anyway - lots for
erwan to think about. Good luck!
Misty