-1

I'm writing a Java application, I need to create a URI Scheme. I've seen a library creating a URI Scheme using the "regedit" command on Windows.

Is it safe to execute "regedit" for this task? Is there anything I should avoid or do in a application that is using the command?

closed as too broad by Robert Harvey, Scant Roger, gnat Nov 23 '15 at 5:05

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What do you mean by "safe?" Will it set off a nuclear missile? Probably not. Does it have the potential for damaging the software on your computer, requiring you to reformat the machine and reinstall the software? Maybe. – Robert Harvey Nov 22 '15 at 23:40
  • It's a really noob question, I never had to use regedit for anything, so I don't know how "dangerous" it can be – user3372036 Nov 22 '15 at 23:43
  • No more dangerous than manipulating the registry with code that you don't understand, I suppose. – Robert Harvey Nov 22 '15 at 23:44
  • Maybe. I have to read more about the registry. – user3372036 Nov 22 '15 at 23:51
2

Launching RegEdit may require administrative privileges, (depending on who is attempting to run it,) so if you attempt to do that, either your application will need to always run with elevated privileges, or some of your users will be prompted with a UAC dialog each time you attempt to launch RegEdit on their behalf. That's not very nice. Why don't you just directly manipulate the registry ? See: https://stackoverflow.com/a/6163701/773113

  • 1
    I searched for questions about URI Schemes in Java and I only found that library. That answer definitely solves my problem, thank you. – user3372036 Nov 22 '15 at 23:41
  • @RobertHarvey It's a lot of reflection, reflection always looks dangerous, I can definitely make that code faster and simpler – user3372036 Nov 22 '15 at 23:44
  • Running regedit does not require admin rights - however it is possible that the administrator has disabled it from normal users on your machine. In the normal case, a normal user can launch regedit just fine but can obviously only change his own keys/values with it. – Brandin Nov 24 '15 at 8:33
  • @Brandin thank you for the input. This is really weird. Every time I run regedit, I get the UAC. (That's why I thought that it always requires elevation.) But if I switch to my wife's unprivileged account, and try to run regedit, I do not get the UAC. – Mike Nakis Nov 24 '15 at 12:42
  • @Brandin I amended my answer, but if you think that the wording can be improved, or that the meaning is still off, please advise. – Mike Nakis Nov 24 '15 at 12:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.