Run reg command in cmd (bat file)?

后端 未结 4 2085
忘了有多久
忘了有多久 2020-12-05 13:09

I\'m trying to run this reg code in cmd (bat file), but I couldn\'t make it work. Where am I doing wrong?

[HKEY_CURRENT_USER\\Software\\Policies\\Microsoft\\         


        
4条回答
  •  -上瘾入骨i
    2020-12-05 13:10

    In command line it's better to use REG tool rather than REGEDIT:

    REG IMPORT yourfile.reg
    

    REG is designed for console mode, while REGEDIT is for graphical mode. This is why running regedit.exe /S yourfile.reg is a bad idea, since you will not be notified if the there's an error, whereas REG Tool will prompt:

    >  REG IMPORT missing_file.reg
    
    ERROR: Error opening the file. There may be a disk or file system error.
    
    >  %windir%\System32\reg.exe /?
    
    REG Operation [Parameter List]
    
      Operation  [ QUERY   | ADD    | DELETE  | COPY    |
                   SAVE    | LOAD   | UNLOAD  | RESTORE |
                   COMPARE | EXPORT | IMPORT  | FLAGS ]
    
    Return Code: (Except for REG COMPARE)
    
      0 - Successful
      1 - Failed
    
    For help on a specific operation type:
    
      REG Operation /?
    
    Examples:
    
      REG QUERY /?
      REG ADD /?
      REG DELETE /?
      REG COPY /?
      REG SAVE /?
      REG RESTORE /?
      REG LOAD /?
      REG UNLOAD /?
      REG COMPARE /?
      REG EXPORT /?
      REG IMPORT /?
      REG FLAGS /?
    

提交回复
热议问题