Adapting .REG Files.  

Page 6 of 13 FirstFirst ... 45678 ... LastLast

  1. Posts : 988
    Microsoft Windows 10 Home
       #51

    Entries under Directory\Shell are available when you right-click on a folder:

    Adapting .REG Files.-context-foreground.png

    Entries under Directory\Background\Shell are available when you right-click in a folder:

    Adapting .REG Files.-context-bacground.png

    If you want the option available for individual files as well, you can create an entry under HKCR\*\Shel, which covers all fileTypes, or create and entry under HKCR\AllFilesystemObjects\Shell, in which case an identical entry under HKCR\Directory\Shell would be redundant, as AllFilesystemObjects is more inclusive.

    EDIT: Some situations just demand a Venn diagram!

    Adapting .REG Files.-hkcr-namespace-venn-diagram.png
    Last edited by KeithM; 24 Feb 2020 at 19:32.
      My Computer


  2. Posts : 17,598
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #52

    OK, I am jumping ahead a bit here.

    Once I have ALL the REG files that I am going to implement I will put them into ONE folder.
    I would then like to run a Batch Script that iterates through that folder and runs EACH REG file in turn!
    For simplicity, I thought it might be best to put the Batch Script in the SAME folder as the REG files and then run it. I would also like a .txt file created of the whole implementation process.
    If so, would this work please . . .

    Code:
    rem @echo off
    Title Import Registry Files.
    >C:\Users\Paul Black\Desktop\RegistryUpdate.txt(
    echo.
    Set RegistryUpdate=%~dp0
    For %%i in ("%RegistryUpdate%*.reg") Do echo "Adding " & (regedit /s "%%i")
    echo.
    echo Imports Complete!
    echo.
    )
    Pause

    Obviously running the REG files in sequence will invoke pressing OK to continue so the use of the /s parameter should suppress that. Will the code above iterate through ALL the files in the folder in sequence and list each one in the console as they are being processed. I have put a pause at the end to be able to see if any failed. Obviously because this is to do with the registry I would like to get it right first time.

    Does anything extra need to be added as far as Run as administrator as some REG files do NOT need to be Run as administrator?

    Thanks in advance.
      My Computer


  3. Posts : 17,598
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #53

    I researched the hex values to understand exactly what they are and why they are in the format that they are.

    Basically, when you EXPORT a REG file, only the String [REG_SZ] and DWORD [REG_DWORD] values are exported in clear readable text.

    The Binary [REG_BINARY], QWORD [REG_QWORD], Multi-String [REG_MULTI_SZ], and Expandable String values [REG_EXPAND_SZ] are exported in the hexadecimal format.

    In order to convert these hex values into readable text, I used Raymondcc's Reg DeHexer. Very nice .exe conversion program that does NOT need installing.

    I just thought I would post this for anyone following this thread that was also curious about what hex values were!
      My Computer


  4. Posts : 988
    Microsoft Windows 10 Home
       #54

    If you want all but REG_BiINARY in human-readable form, export the registry key(s) in text format:

    Adapting .REG Files.-screenshot-635-.png
    The files can't be merged like .reg, but they're a handy reference:

    Adapting .REG Files.-screenshot-636-.png

    You can also use PowerShell to query & view egistry entries. REG_EXPAND_SZ entries will have their environmetal variables expanded:

    Code:
    PS C:\...\keith>$USF = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' 
    
    PS C:\...\keith>Get-ItemProperty $USF                                                                 
    
    AppData                                : C:\Users\keith\AppData\Roaming
    Cache                                  : C:\Users\keith\AppData\Local\Microsoft\Windows\INetCache
    Cookies                                : C:\Users\keith\AppData\Local\Microsoft\Windows\INetCookies
    Desktop                                : C:\Users\keith\Desktop
    Favorites                              : C:\Users\keith\Favorites
    History                                : C:\Users\keith\AppData\Local\Microsoft\Windows\History
    Local AppData                          : C:\Users\keith\AppData\Local
    My Music                               : C:\Users\keith\Music
    NetHood                                : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Network
                                             Shortcuts
    Personal                               : C:\Users\keith\Documents
    PrintHood                              : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Printer
                                             Shortcuts
    Programs                               : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Start
                                             Menu\Programs
    Recent                                 : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Recent
    Start Menu                             : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Start Menu
    Startup                                : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Start
                                             Menu\Programs\Startup
    Templates                              : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Templates
    {374DE290-123F-4565-9164-39C4925E467B} : C:\Users\keith\Downloads
    {B7BEDE81-DF94-4682-A7D8-57A52620B86F} : C:\Users\keith\Screenshots
    {31C0DD25-9439-4F12-BF41-7FF4EDA38722} : C:\Users\keith\Sandbox
    SendTo                                 : C:\Users\keith\AppData\Roaming\Microsoft\Windows\SendTo
    {F42EE2D3-909F-4907-8871-4C22FC0BF756} : C:\Users\keith\Documents
    {491E922F-5643-4AF4-A7EB-4E7A138D8174} : C:\Users\keith\AppData\Roaming\Microsoft\Windows\Libraries\N
                                             ew Videos.library-ms
    PSPath                                 : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Softwa
                                             re\Microsoft\Windows\CurrentVersion\Explorer\User Shell
                                             Folders
    PSParentPath                           : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Softwa
                                             re\Microsoft\Windows\CurrentVersion\Explorer
    PSChildName                            : User Shell Folders
    PSDrive                                : HKCU
    PSProvider                             : Microsoft.PowerShell.Core\Registry
    Also, as a PowerShell convert, I think you should use it for your import as well:
    Code:
    Get-ChildItem '.\*.reg' | ForEach{
        $Result = Start-Process Reg -ArgumentList Import, $_ -Wait -PassThru
        echo ( '{0} - {1}' -f $Result.ExitCode, $_.Name)
    }
    It's also great for peering into those binary values (especially the lonfwe ones) if you want to examine those:

    Demo:
    Code:
    (gi $BagMRU).Property | ? {$_ -match '\d+'} | ForEach{
        Get-ItemPropertyValue $BagMRU $_ | Format-Hex
        Pause
    }
    Code:
    PS C:\...\keith>$BagMRU  = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU'
    
    PS C:\...\keith>
    
    PS C:\...\keith>(gi $BagMRU).Property | ? {$_ -match '\d+'} | ForEach{
    >>     Get-ItemPropertyValue $BagMRU $_ | Format-Hex
    >>     Pause
    >> }
    >>
    >>                                                                                              
    
               00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    
    00000000   14 00 1F 50 E0 4F D0 20 EA 3A 69 10 A2 D8 08 00  ...PO :i...
    00000010   2B 30 30 9D 00 00                                +00..
    Press Enter to continue...:
    
    
               00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    
    00000000   14 00 1F 80 CB 85 9F 67 20 02 80 40 B2 9B 55 40  ...˅g .@@
    00000010   CC 05 AA B6 00 00                                ...
    Press Enter to continue...:
    
    
               00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    
    00000000   14 00 1F 44 47 1A 03 59 72 3F A7 44 89 C5 55 95  ...DG..Yr?DU
    00000010   FE 6B 30 EE 00 00                                k0..
    Press Enter to continue...:
    Last edited by KeithM; 25 Feb 2020 at 15:46.
      My Computer


  5. Posts : 17,598
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #55

    I have Googled this question but I can't seem to find a definitive answer to it!

    What is the difference in using @="UnBlock ALL Files" as a label as opposed to using "MUIVerb"="UnBlock ALL Files" as a label please?

    Thanks in advance.
      My Computer


  6. Posts : 988
    Microsoft Windows 10 Home
       #56

    Multilingual User Interface (MUI)

    If you search your own registry rather than Google, you'll see MUIverb entries that look like @efscore.dll,-103, a resource reference.

    So, if you're using literal strings, there's very little differnece. but when you add Multilingal support with varous language-specific .dlls, your verbs will change according to the user's specified language.
      My Computer


  7. Posts : 17,598
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #57

    Hello @KeithM,

    KeithM said:
    Also, as a PowerShell convert, I think you should use it for your import as well:
    Code:
    Get-ChildItem '.\*.reg' | ForEach{
        $Result = Start-Process Reg -ArgumentList Import, $_ -Wait -PassThru
        echo ( '{0} - {1}' -f $Result.ExitCode, $_.Name)
    }
    I have pretty much finished with what I was trying to do!

    I have ended up with a folder that contains .reg, .ps1, and .bat files [about 80 files in total].
    I have created a Script for each.
    I want to run ALL of the files one after the other in SILENT mode within the Implement Folder.
    Code:
    @echo off
    Set Folder=C:\Implement
    For %%i In (%Folder%\*.reg) Do (regedit /s %%i)
    echo.
    echo REG Implementation Completed Successfully!
    Pause
    EXIT
    Code:
    @echo off
    Set Folder=C:\Implement
    Set PowerShellExe=%windir%\System32\WindowsPowerShell\v1.0\powershell.exe
    For %%i In (%Folder%\*.ps1) Do (%PowerShellExe% -NoProfile -ExecutionPolicy Bypass -Command %cd%\%%i)
    echo.
    echo PS Implementation Completed Successfully!
    Pause
    EXIT
    Code:
    @echo off
    Set Folder=C:\Implement
    Set cmdExe=%windir%\System32\cmd.exe
    For %%i In (%Folder%\*.bat) Do (%cmdExe% \%%i)
    echo.
    echo CMD Implementation Completed Successfully!
    Pause
    EXIT
    I thought I would post the code before I ran it in case anything jumps out as being wrong!

    Is there any way that your PS Script can be adapted to run the above code instead please?
    Ideally, I would also like it to list the file name as it runs each file, something like . . . Write-Host "Running Script : " $s.Name.

    Thanks in advance.
      My Computer


  8. Posts : 7,598
    Windows 10 Home 20H2
       #58

    Paul Black said:
    Once I have ALL the REG files that I am going to implement I will put them into ONE folder.
    I would then like to run a Batch Script that iterates through that folder and runs EACH REG file in turn!
    Why not use a single script file to write everything into Windows Registry?
      My Computer


  9. Posts : 17,598
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #59

    Thanks for the reply @Matthew Wai.

    Matthew Wai said:
    Why not use a single script file to write everything into Windows Registry?
    I assume by what you have stated above that my scripts will not do what I want them to?
    The main one I would like is for the .reg files in a folder because there are about 85 of them!
    How would I achieve this with a script?

    Thanks in advance.
      My Computer


  10. Posts : 7,598
    Windows 10 Home 20H2
       #60

    Paul Black said:
    Code:
    @echo off
    Set Folder=C:\Implement
    For %%i In (%Folder%\*.reg) Do (regedit /s %%i)
    echo.
    echo REG Implementation Completed Successfully!
    Pause
    EXIT
    I have added the "PowerShell" line, so that the CMD script will get administrative privileges automatically.
    Code:
    @echo off
    (Net session >nul 2>&1)||(PowerShell start -verb runas '%~0' &exit /b)
    For %%I In ("C:\Implement\*.reg") Do (regedit /s "%%I")
    If %errorlevel%==0 echo. & echo All the .reg files have been merged. 
    pause
      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 23:43.
Find Us




Windows 10 Forums