Registry key with spaces

Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag von SisterOfMercy »

Thanks!
But why isn't this in the 4.11.3 branch? I'm missing something, right? :oops:
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Registry key with spaces

Beitrag von SisterOfMercy »

Ok, when looking at osparser.pas I find this:

Code: Alles auswählen

        if Is64BitSystem and (GetNTVersionMajor < 6) and regist.myforce64 then
        begin
          // Workaround for RegDeleteKey 64 Bit problem
         //errorcode := RegDeleteKeyEx(mykey, PChar(keytoopen), KeyOpenMode,0);
          output := TXStringList.create;
          commandline := 'cmd64.exe /c "reg delete '+key_completepath+' /f';
          LogDatei.DependentAdd ('Executing ' + commandline, LLinfo);
          if not RunCommandAndCaptureOut(commandline,true,output, report, SW_SHOWMINIMIZED, FLastExitCodeOfExe) then
          Begin
            ps := 'Error: ' + Report;
            LogDatei.DependentAddError (ps, LLerror);
          End
Change this line:

Code: Alles auswählen

          commandline := 'cmd64.exe /c "reg delete '+key_completepath+' /f';
to this:

Code: Alles auswählen

          commandline := 'cmd64.exe /c "reg delete "'+key_completepath+'" /f';
And then it should work. I just tested this:

Code: Alles auswählen

C:\Documents and Settings\mylusername>cmd64.exe /c "reg delete HKEY_CURRENT_USER\Software\test 2 /f"
ERROR: Invalid syntax.
Type "REG DELETE /?" for usage.

C:\Documents and Settings\mylusername>cmd64.exe /c "reg delete "HKEY_CURRENT_USER\Software\test 2" /f"
The operation completed successfully.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten