commenting out a line in a regedit file possible?


  1. Posts : 740
    Windows 10 x64 Pro
       #1

    commenting out a line in a regedit file possible?


    So i have a large .reg file that makes lots of changes. some i want to "save for later" but not remove from the reg file.

    is this possible?

    for example in a robocopy script you can precede any command with :: and it will not execute that command.

    Does something like this exist for regedit? If so does it preceding the key invalidate that key and the string below it or must it precede both? (id imagine both as the key would indicate where the string is to go, but rather not test the theory and have a string flung in some no-mans-land in my registry lol)
      My Computer


  2. Posts : 17,057
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #2

    Start a comment line with ; in .reg files.
    - Only that individual line is skipped
    - If you comment out a key then any following line about setting values within that key would be meaningless and cause errors.
    - So comment out each line of any block you need to skip

    Just for completeness
    - in VBS & VBA, start a comment line with '
    - in a batch file start a comment file with :: [as you already know]
    - in PS, start a comment line with #

    Denis
      My Computer


  3. Posts : 56,926
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #3

    klepp0906 said:
    So i have a large .reg file that makes lots of changes. some i want to "save for later" but not remove from the reg file.

    is this possible?

    for example in a robocopy script you can precede any command with :: and it will not execute that command.

    Does something like this exist for regedit? If so does it preceding the key invalidate that key and the string below it or must it precede both? (id imagine both as the key would indicate where the string is to go, but rather not test the theory and have a string flung in some no-mans-land in my registry lol)
    Here's an example of one of Shawn's .reg files from a tutorial.

    Code:
    Windows Registry Editor Version 5.00
    
    ; Created by: Shawn Brink
    ; https://www.tenforums.com
    ; Tutorial: https://www.tenforums.com/tutorials/30231-mount-context-menu-add-remove-windows-10-a.html
    
    
    [HKEY_CLASSES_ROOT\Windows.IsoFile\shell\mount]
    "CommandStateSync"=""
    "ExplorerCommandHandler"="{9ab3b1c9-3225-4bb4-93b6-bfb3c0d93743}"
    "MultiSelectModel"="Document"
    
    ; [HKEY_CLASSES_ROOT\Windows.IsoFile\shell\mount\command]
    ; @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
    ;  00,5c,00,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,65,00,78,00,\
    ;  65,00,00,00
    ; "DelegateExecute"="{9ab3b1c9-3225-4bb4-93b6-bfb3c0d93743}"
    By adding a "; " before the line, it becomes a comment, like the top lines are.
      My Computers


  4. Posts : 740
    Windows 10 x64 Pro
    Thread Starter
       #4

    thank you gentlemen. EXACTLY the info i needed to know :) surprisingly enough, google wasnt too helpful in that regard. Found plenty of references to "adding" a comment with a ; but nobody verifying if it would prevent a key from being added, much less how it would behave with subsequent strings.

    every example i saw was someone adding comments to a reg. I need to simply temp-omit some stuff and save it for later :P

    you guys are doing gods work <3
      My Computer


  5. Posts : 56,926
    Multi-boot Windows 10/11 - RTM, RP, Beta, and Insider
       #5

    You're welcome!
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:42.
Find Us




Windows 10 Forums