Closed jhmaster2000 closed 1 month ago
The question here is: Can I create a registry key or value with a name that contains /
? Then we need a logic to deside if its part of the name or split to elements.
Yes, you can create a registry and a value with a name containing /
I investigated this and found out something. Here are my findings -
/
or \
to navigate.\
, but we can use /
. Therefore, the default behavior.If we were to implement this feature, we would have ambiguities in resolving the name and the path (as suggested by @htcfreek). For eg -
HKEY_CLASSES_ROOT/Something/Data
has two meanings -
Something/Data
is a value, orData
is a value, inside of Something
, a keyI don't know the proper solution, but I have a suggestion. We could use "
to identify the values. So, for referring to the above, we can use the following notation -
HKEY_CLASSES_ROOT/Something/Data
- this is where Data
is a value, inside of Something
, a keyHKEY_CLASSES_ROOT/"Something/Data"
- this is where Something/Data
is a valueIn hindsight, this solution is functional, but not pretty to look at. Different approaches are always welcome 😄
@htcfreek what do you think about the above approach?
That I understand correctly:
/
and \
in it's name./
, but not \
.So we would have a problem to decide if the slash is part of the key path
or value name
as you said? But don't we still use the !
or \\
for separating path and value name?
@htcfreek A little correction.
/
in it's name./
and \
Does that change anything though?
On a side note, when do we use !
in this?
@htcfreek A little correction.
- The key path allows
/
in it's name.- The value can contain both
/
and\
Does that change anything though?
Nor for the value name. But for the key path. How do we decide if the typed /
is part of a key name or not? 🤔
On a side note, when do we use
!
in this?
My mistake. The rule is key path\\value name
. (https://github.com/microsoft/PowerToys/blob/main/src%2Fmodules%2Flauncher%2FPlugins%2FMicrosoft.PowerToys.Run.Plugin.Registry%2FHelper%2FQueryHelper.cs#L44)
For the key path problem, we could use "
to denote a key name. If we are not using those, that becomes part of the path. How does that sound to you?
HKEY_CLASSES_ROOT/Something/Data
- this is whereData
is another key, inside ofSomething
, a keyHKEY_CLASSES_ROOT/"Something/Data"
- this is whereSomething/Data
is a key
For the key path problem, we could use
"
to denote a key name. If we are not using those, that becomes part of the path. How does that sound to you?
HKEY_CLASSES_ROOT/Something/Data
- this is whereData
is another key, inside ofSomething
, a keyHKEY_CLASSES_ROOT/"Something/Data"
- this is whereSomething/Data
is a key
Sounds good to me, even when it prevents simple copy and paste of such paths into pt run. @davidegiacometti what do you think?
By the way: If you have the code to detect the escaping/enclosing, I am interested in for an other issue.
@htcfreek You know what! You are lucky for me. I was searching for the regex expression for a very long time. And the moment you pinged me, I got it. Have a look at it and let me know if we need any corrections.
@htcfreek You know what! You are lucky for me. I was searching for the regex expression for a very long time. And the moment you pinged me, I got it. Take a look at it below and let me know if we need any corrections.
Seems to be perfect. ♥️
Hi @htcfreek, I have opened a draft PR trying to fix the issue. However, when I enter the first "
, the context menu doesn't display any suggestions, but if I complete the same, it defaults to its normal behavior. GIF attached -
Another issue that I'm having is when I select anything from the context menu, the whole path changes from /
to \
. GIF attached -
@GhostVaibhav
I think the automatic change is okay as long as this doesn't kill the key nane containing a /
. (And btw this happens as the result uses \
and selecting it updates the query field.)
The registry contains:
Hklm\software\test\key\223\new
hklm\software\test/key\223\new
And the user types hklm/software/test/
.Can we then suggest the two options as results:
Hklm\software\test\key
hklm\software\"test/key"
So that the user can select it and then continue typing with /
like Hklm\software\test/key\223/new
.@GhostVaibhav Regarding the query text update: https://github.com/microsoft/PowerToys/blob/main/src%2Fmodules%2Flauncher%2FPlugins%2FMicrosoft.PowerToys.Run.Plugin.Registry%2FHelper%2FResultHelper.cs#L49
Description of the new feature / enhancement
: hkcu/AppEvents
should work the same as: hkcu\AppEvents
Scenario when this would be used?
Other plugins such as Folders support slash interchangeability,
C:/Windows
andC:\Windows
both work the same perfectly in PowerToys Run, one would expect to also be able to use the nicer forward slash on Registry paths but it currently breaks the Registry plugin.Supporting information
I understand under the hood regedit doesn't support
/
, I expect the plugin can simply replace all/
with\
on the fly between the user input and processing under the hood.