Windows 10: REG ADD works from cmdline but not batch

Discus and support REG ADD works from cmdline but not batch in Windows 10 Support to solve the problem; I've been trying to figure this one out and I'm sure it's something simple I've missed. This will add a reg entry to a local pc when used from an... Discussion in 'Windows 10 Support' started by rl24712, Dec 28, 2019.

  1. rl24712 Win User

    REG ADD works from cmdline but not batch


    I've been trying to figure this one out and I'm sure it's something simple I've missed.

    This will add a reg entry to a local pc when used from an elevated cmd prompt, but doesn't work when I run it in a .cmd file with run as admin?

    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "StartLayoutFile" /t REG_EXPAND_SZ /d "C:\Windows\StartLayout.xml"

    :)
     
    rl24712, Dec 28, 2019
    #1
  2. Try3 Win User

    Import reg file in a batch file

    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 asecho 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 aPause 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
     
  3. jinkazama Win User
    Import reg file in a batch file

    but the reg imported in batch file do not disable cortana
     
    jinkazama, Dec 28, 2019
    #3
  4. REG ADD works from cmdline but not batch

    Windows 10 infinite restart black screen


    The tutorials provided are just a list of troubleshooting steps. Use only the steps which apply to you.

    Since none of the troubleshooting steps here worked, I'd suggest you do a Clean install.

    John
     
    AmericanPharaoh, Dec 28, 2019
    #4
Thema:

REG ADD works from cmdline but not batch

Loading...
  1. REG ADD works from cmdline but not batch - Similar Threads - REG ADD works

  2. ERROR: Invalid syntax. Type "REG ADD /?" for usage

    in Windows 10 Gaming
    ERROR: Invalid syntax. Type "REG ADD /?" for usage: I tried to run this in a batch file reg add “HKEY_CURRENT_USER\Software\LMS\LMS Test.Lab 22A\22A\Test.Lab\Settings” /v Project /t REG_EXPAND_SZ /d “H:\%USERNAME%\Testlab Data” /fIt fails with invalid syntax error. But if i copy the same command & run it in command prompt. It...
  3. ERROR: Invalid syntax. Type "REG ADD /?" for usage

    in Windows 10 BSOD Crashes and Debugging
    ERROR: Invalid syntax. Type "REG ADD /?" for usage: I tried to run this in a batch file reg add “HKEY_CURRENT_USER\Software\LMS\LMS Test.Lab 22A\22A\Test.Lab\Settings” /v Project /t REG_EXPAND_SZ /d “H:\%USERNAME%\Testlab Data” /fIt fails with invalid syntax error. But if i copy the same command & run it in command prompt. It...
  4. Batch file not working

    in Windows 10 Network and Sharing
    Batch file not working: Hello, Iam making autorun project that if I plug Flash disc in my pc it autoruns batch file with my "assistant" what says Hi, what do you want? But here are things that just doesn´t work: 1.If I plug in the Flash disc autorun.inf dont do anything. 2.If I manage batch file...
  5. how to reg add via cmd-script

    in Windows 10 Ask Insider
    how to reg add via cmd-script: Hello everybody, I want to add a registry by starting a cmd-script. Therefore i have implemented the following line: REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /V "%CDh%\Launcher.exe" /t REG_SZ /d "WIN98 256COLOR 640X480" /f But...
  6. Batch or Reg edit to toggle Background profiles?

    in Windows 10 Customization
    Batch or Reg edit to toggle Background profiles?: Is there some for sort of reg edit trick or batch file (The later being more like. I know they are very different) to set two background/wallpaper "profiles"? By default, I have my wallpaper set to a folder based slideshow. But if I host a conference meeting with a client, I...
  7. Type "REG ADD /?" for usage.

    in Windows 10 BSOD Crashes and Debugging
    Type "REG ADD /?" for usage.: reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v AllowRemoteRPC /t REG_DWORD /d 1 /f - ERROR: Invalid syntax. Type "REG ADD /?" for usage. how to fix?...
  8. Import reg file in a batch file

    in Windows 10 Support
    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...
  9. Reg file to batch remove BLOCK from files /Folder

    in Windows 10 Performance & Maintenance
    Reg file to batch remove BLOCK from files /Folder: Hi I found this, which I added to the registry but the right click option to unblock files / folders hasnt appeared any help please [HKEY_CLASSES_ROOT\*\shell\unblockfile]@=”Unblock file”[HKEY_CLASSES_ROOT\*\shell\unblockfile\command]@=”cmd /c streams -d...
  10. Reg/batch to disable "Open File - Security Warning"

    in Windows 10 Support
    Reg/batch to disable "Open File - Security Warning": Hi guys, Is there a reg/batch script or group policy to turn off this annoying screen in Windows 10? [img] I know it can be disabled somewehre in IE options but I need it to be a a script or something. 45444