Import reg file in a batch file

Page 1 of 2 12 LastLast

  1. Posts : 8
    Windows 10
       #1

    Import reg file in a batch file


    Hi, i've a reg file to mod windows 10 that works properly, but if i import it in a batch file it doesn't work.
    this is the reg file i've called Windows10.reg
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons]
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu]
    ; Cartella utente
    "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"=dword:00000000
    ; Computer
    "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000
    ; Rete
    "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dword:00000000
    ; Cestino
    "{645FF040-5081-101B-9F08-00AA002F954E}"=dword:00000000
    ; Pannello di controllo
    "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"=dword:00000001
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
    ; Cartella utente
    "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"=dword:00000000
    ; Computer
    "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000
    ; Rete
    "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dword:00000000
    ; Cestino
    "{645FF040-5081-101B-9F08-00AA002F954E}"=dword:00000000
    ; Pannello di controllo
    "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"=dword:00000001
    
    ; Cortana Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
    "AllowCortana"=dword:00000000
    
    ; Smartscreen Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer]
    "SmartScreenEnabled"="Off"
    
    ; Defender Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
    "DisableAntiSpyware"=dword:00000001
    
    ; Onedrive Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OneDrive]
    "DisableFileSyncNGSC"=dword:00000001
    
    ; Icona Contatti Disabilita
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People]
    "PeopleBand"=dword:00000000
    If i import it in a batch file called Windows10.cmd which run the reg and force the Explorer refresh to apply it
    Code:
    reg import Windows10.reg
    taskkill /f /im explorer.exe
    start explorer.exe
    some features don't work (for example Cortana is not disabled).
    Can you help me to understand where is the problem?
    Thank you
      My Computer


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

    jinkazama said:
    Hi, i've a reg file to mod windows 10 that works properly, but if i import it in a batch file it doesn't work.
    this is the reg file i've called Windows10.reg
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons]
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu]
    ; Cartella utente
    "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"=dword:00000000
    ; Computer
    "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000
    ; Rete
    "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dword:00000000
    ; Cestino
    "{645FF040-5081-101B-9F08-00AA002F954E}"=dword:00000000
    ; Pannello di controllo
    "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"=dword:00000001
    
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
    ; Cartella utente
    "{59031a47-3f72-44a7-89c5-5595fe6b30ee}"=dword:00000000
    ; Computer
    "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000
    ; Rete
    "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dword:00000000
    ; Cestino
    "{645FF040-5081-101B-9F08-00AA002F954E}"=dword:00000000
    ; Pannello di controllo
    "{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"=dword:00000001
    
    ; Cortana Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
    "AllowCortana"=dword:00000000
    
    ; Smartscreen Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer]
    "SmartScreenEnabled"="Off"
    
    ; Defender Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
    "DisableAntiSpyware"=dword:00000001
    
    ; Onedrive Disabilita
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\OneDrive]
    "DisableFileSyncNGSC"=dword:00000001
    
    ; Icona Contatti Disabilita
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People]
    "PeopleBand"=dword:00000000
    If i import it in a batch file called Windows10.cmd which run the reg and force the Explorer refresh to apply it
    Code:
    reg import Windows10.reg
    taskkill /f /im explorer.exe
    start explorer.exe
    some features don't work (for example Cortana is not disabled).
    Can you help me to understand where is the problem?
    Thank you
    @jinkazama

    You may need to run your batch file (.cmd) as Administrator. Right click it, and Run as Admin.
      My Computers


  3. Posts : 8
    Windows 10
    Thread Starter
       #3

    i've tried to run it as admin but nothing change, i attach an image to show the problem
    Attached Thumbnails Attached Thumbnails Import reg file in a batch file-cattura.jpg  
      My Computer


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

    jinkazama said:
    i've tried to run it as admin but nothing change, i attach an image to show the problem
    That's just the default Search icon. If you disable Cortana, you still get the generic "Search". Just like the one you see if you right-click the Start Button. It's fine.
      My Computers


  5. Posts : 8
    Windows 10
    Thread Starter
       #5

    but the reg imported in batch file do not disable cortana
      My Computer


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

    jinkazama said:
    but the reg imported in batch file do not disable cortana
    Have you looked at the tutorial here on Tenforums for disabling Cortana? It may help.....

    Enable or Disable Cortana in Windows 10 | Windows 10 Tutorials
      My Computers


  7. Posts : 486
    Windows 10x64 17713
       #7

    Some changes to the registry can't be made even when running as administrator. More than likely that's one of them.
      My Computer


  8. Posts : 17,016
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #8

    In the hope of being helpful to all -

    jinkazama said:
    i've tried to run it as admin but nothing change, i attach an image to show the problem
    This diagram seems to have been misinterpreted by the other posters. The diagram, if I understand it correctly, shows that
    1 [left-hand side] Running the change using a batch file to import the relevant Registry keys fails to disable Cortana and hence the Taskbar still shows the Cortana icon.
    2 [right-hand side] Running the change using a Reg file to import the relevant Registry keys successfully disables Cortana and hence the Taskbar shows the Search icon.

    Whatever the OP's problem is, it is something to do with how the batch file reg import command operates.
    - The OP has dealt with the possibility that Admin permissions are to blame.
    - The OP has dealt with the possibility that the wrong Registry key settings are being addressed.
    - The OP has dealt with the possibility that there is some permissions problem affecting the Registry keys concerned. Those keys can most definitely be changed.

    Denis
      My Computer


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

    I see, yes, misinterpreted. Off the OP's topic of how to make the CMD work...

    If the .reg works just fine, and the .cmd does not for as yet unknown reasons....why not just use the .reg? How many times does this need to be done?

    Not meaning to sound frivolous, but is this now simply an academic exercise?
      My Computers


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

    jinkazama said:
    but the reg imported in batch file do not disable cortana
    I suggest that, as a first step, you edit the batch file so it captures the errorlevel after the reg import command.

    - Something simple such as
    echo The reg import command result is - %ErrorLevel%
    will do as long as long as you put it in as the line straight after the reg import command and then put a
    Pause
    command in as the next line [before restarting explorer] so you can have a look.

    - Checking the errorlevel will tell you whether reg import thinks it has completed correctly or not.
    - While you are checking the errorlevel you could also go to the Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search] to see what has happened to it [make sure you Refresh the view if you were already at that key beforehand]



    I have never used reg import but I know there are optional arguments for 32/64 bit items so perhaps you might investigate them
    - enter reg import /? >RegImport.txt in a command prompt to save the Help guidance that mentions these switches.
    - I do not think these switches are relevant but I have never investigated their use properly.
    - For all I know, the problem might be as simple as reg import not being able to handle the comment lines, such as ; Cartella utente, properly

    Best of luck,
    Denis
    Last edited by Try3; 05 Jul 2018 at 13:22.
      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 11:48.
Find Us




Windows 10 Forums