New .reg file but not blank


  1. Posts : 318
    Windows 10 Home Single Language 21H1
       #1

    New .reg file but not blank


    Hey guys!

    It is a part of script after clean install to add bat,ps1,reg,vbs to new context menu
    REG ADD "HKCR\.ps1\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.reg\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.bat\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.vbs\ShellNew" /v "NullFile" /t REG_SZ /d "" /f

    I want this this line and a blank line, when i create a new reg file. What i need to add to the script?

    Windows Registry Editor Version 5.00

      My Computer


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #2

    Hello @Feuer,

    Feuer said:
    It is a part of script after clean install to add bat,ps1,reg,vbs to new context menu:

    REG ADD "HKCR\.ps1\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.reg\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.bat\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.vbs\ShellNew" /v "NullFile" /t REG_SZ /d "" /f

    I want this line and a blank line, when i create a new reg file. What i need to add to the script?

    Windows Registry Editor Version 5.00

    That line tells the OS that the file is a registry file, and is needed for ALL .reg files. it does NOT show up in the Context Menu itself.

    Do you mean this, which puts a continuous line to separate the different sections? . . .

    Code:
    
    "CommandFlags"=dword:00000020

    I hope this helps.
      My Computer


  3. Posts : 318
    Windows 10 Home Single Language 21H1
    Thread Starter
       #3

    Hello Paul, thanks for your answer.
    I think i need to explain;

    When I apply this tweak
    REG ADD "HKCR\.reg\ShellNew" /v "NullFile" /t REG_SZ /d "" /f

    I have a new registry file entry in new menu, (it is ok, i havent problem with this)


    Problem is here; it gives me an empty reg file.


    but i want this; Windows Registry Editor Version 5.00 and a blank line
      My Computer


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #4

    Hello @Feuer,

    Sorry, I am NOT following what you mean.

    When you create a .reg file, the Windows Registry Editor Version 5.00 MUST be the FIRST line in order for the OS to know that the file is a registry file. Then you enter your REG commands, and save the file as a .reg file. To implement the file, you double-click it and select Merge.

    You can add descriptions / notes in the file by using ;, a bit like REM in Batch scripts.

    I hope this helps.
      My Computer


  5. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #5

    Hello @Feuer,

    Have a look at this to see if it help . . .

    > How to add, modify, or delete registry subkeys and values by using a .reg file

    I hope this helps.
      My Computer


  6. Posts : 318
    Windows 10 Home Single Language 21H1
    Thread Starter
       #6

    Paul Black said:
    Hello @Feuer,

    Sorry, I am NOT following what you mean.

    When you create a .reg file, the Windows Registry Editor Version 5.00 MUST be the FIRST line in order for the OS to know that the file is a registry file. Then you enter your REG commands, and save the file as a .reg file. To implement the file, you double-click it and select Merge.

    You can add descriptions / notes in the file by using ;, a bit like REM in Batch scripts.

    I hope this helps.
    Hey @Paul Black

    Thanks again.
    I know reg file needs Windows Registry Editor Version 5.00 it is why i am asking what i need to add to my batch code;

    REG ADD "HKCR\.reg\ShellNew" /v "NullFile" /t REG_SZ /d "" /f

    I have to create this line Windows Registry Editor Version 5.00 manually because windows gives me an empty reg file when i create.

    EDIT: Thanks for your effort Paul
    I have just found it

    Registry Overview - ShellNew

    HKCR\.ext Default ="Pointer to another key"
    HKCR\.ext\ShellNew Default =(value not set)
    Command ="any valid command"
    FileName="any file in the Template directory"
    NullFile=""
    Data =the actual text (bytes) to be
    placed in the file


    Data value is what i was looking for ^^

    REG ADD "HKCR\.reg\ShellNew" /v "NullFile" /t REG_SZ /d "" /f
    REG ADD "HKCR\.reg\ShellNew" /v "Data" /t REG_SZ /d "Windows Registry Editor Version 5.00" /f
      My Computer


  7. Posts : 5,453
    Windows 11 Home
       #7

    As a workaround, create a predefined reg file and set it as read only.
    Every time you will want to save, it will ask you to save it as a new file.
      My Computer


 

  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 10:31.
Find Us




Windows 10 Forums