Search code examples
windowsbatch-fileregistrywindows-server-2003-r2

Invalid key name


In a quick and dirty backup script that's been running fine for years, the registry backup part no longer works. I run the offending code in the command line and get the same result:

C:\>reg export /y HKLM\SOFTWARE\ODBC\ODBC.INI test.reg
ERROR: nombre de clave no válido.
Escriba "REG EXPORT /?" para obtener detalles de uso.

Error translates as "invalid key name". If I lauch regedit and copy the key name to clipboard I get this:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI

If there is a typo, I'm unable to spot it.

Am I really mistyping the key name? Is there any other reason for the error?


Solution

  • Documentation says this:

    Reg export KeyName FileName [/y]
    

    In other words, flags come last:

    C:\>reg export HKLM\SOFTWARE\ODBC\ODBC.INI test.reg /y
    La operación se ha completado correctamente.
    

    No idea why it's been working before.