Help with a .bat file.  

Page 1 of 3 123 LastLast

  1. Posts : 773
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.2006)
       #1

    Help with a .bat file.


    I have this .bat file that I've been messing around with:

    Help with a .bat file.-bat-file.png

    I got it to open the Windows Update interface:

    Help with a .bat file.-windows-update.png

    However, I need the .bat file to go a step further and auto click the Check for updates button circled in orange.

    Can someone help me to finish editing the .bat file so that when I click the .bat file, the process of manually checking for Windows Updates becomes fully automated?
      My Computer


  2. Posts : 844
    Windows 11 x64 22624.2283
       #2

    Hi @EyeInTheSky

    Here is the command to make the .bat file work correctly:
    Code:
    @echo off
    explorer ms-settings:windowsupdate-action

    You can also add an entry to the right click context menu:
    Code:
    Windows Registry Editor Version 5.00
    
    ;Add Check for Windows Updates to Right Click Context Menu
    [HKEY_CLASSES_ROOT\Directory\background\Shell\Check for Windows Updates]
    "Icon"="shell32.dll,-16739"
    "Position"=-
    
    [HKEY_CLASSES_ROOT\Directory\background\Shell\Check for Windows Updates\command]
    @="explorer ms-settings:windowsupdate-action"

    To remove the entry:
    Code:
    Windows Registry Editor Version 5.00
    
    ;Remove Check for Windows Updates from Right Click Context Menu
    [-HKEY_CLASSES_ROOT\Directory\background\Shell\Check for Windows Updates]
    
    [-HKEY_CLASSES_ROOT\Directory\background\Shell\Check for Windows Updates\command]
      My Computer


  3. Posts : 15,932
    Windows 10 Home x64 Version 22H2 Build 19045.3324
       #3

    You can make a shortcut instead of a batch file - see
    Create Check for updates shortcut - TenForumsTutorials

    Denis
      My Computer


  4. Posts : 2,677
    Windows 10 Pro for the Bro
       #4

    Yea I use a Shortcut instead of a bat file (to avoid that black command window).

    1) Right Click on Desktop > New > Shortcut
    2) Insert: ms-settings:windowsupdate-action
    3) Press Next
    4) Name it: Windows Update (or anything you prefer)
    5) Press Finish


    Check the Tutorial in the link in the post before mine.


    I have a Windows icon that I use for that shortcut:
    Windows.ico

    Help with a .bat file.-image.png
      My Computer


  5. Posts : 773
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.2006)
    Thread Starter
       #5

    Polo6RGTI said:
    Hi @EyeInTheSky

    Here is the command to make the .bat file work correctly:
    Code:
    @echo off
    explorer ms-settings:windowsupdate-action
    I tried your .bat file and it does the same thing as mine. It opens the Windows Update interface, but I still have to manually click "check for updates".

    Anything else I can try? I also already have the right click context menu entry as well and that's working fine. I just want the .bat file to fully automate the Check for updates function.

    Try3 said:
    You can make a shortcut instead of a batch file - see
    Create Check for updates shortcut - TenForumsTutorials

    Denis
    I already have a shortcut; I'm trying to create a .bat file to fully force a manual check for updates and then to close the update interface after it starts to check for updates.

    If you open the Windows Update interface and click "Check for updates", and close the interface; you'll notice that if you re-open the interface again, it is still checking for updates from the first time you originally clicked "Check for updates".

    pepanee said:
    Yea I use a Shortcut instead of a bat file (to avoid that black command window).
    The command window is not a problem, as it auto closes upon the immediate open of the Windows Update interface.

    It does this because the word "pause" is not at the end of my .bat file.
    Last edited by EyeInTheSky; 29 Oct 2018 at 21:48.
      My Computer


  6. Posts : 15,932
    Windows 10 Home x64 Version 22H2 Build 19045.3324
       #6

    I do not use WU but, from memory, I think I had to set the shortcut's properties, Advanced, Always run as Admin to make it act in the way you want.

    Denis
      My Computer


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

    You can try this tool, it is supposed to have command line switches.
    Code:
    https://github.com/DavidXanatos/wumgr/releases
      My Computer


  8. Posts : 773
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.2006)
    Thread Starter
       #8

    TairikuOkami said:
    You can try this tool, it is supposed to have command line switches.
    That tool is kind of neat. I looked through all the wumgr releases and I'm not sure where to look for the command line switches. I opened a lot of the source code with notepad to get "a peek under the hood" so to speak; possibly in hopes of seeing a familiar reference to what I'm looking for.

    It will take a while to look through it all. I don't think a .bat file exists for what I'm trying to accomplish.
      My Computer


  9. Posts : 14,925
    Windows10
       #9

    Powershell is really great for handling updates.

    Update and Upgrade Windows 10 using PowerShell | Windows 10 Tutorials
      My Computer


  10. Posts : 5,373
    Windows 11 Home
       #10

    EyeInTheSky said:
    I don't think a .bat file exists for what I'm trying to accomplish.
    The command for checking out updates works in my bat, so it has to blocked by something on your PC.
      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 19:43.
Find Us




Windows 10 Forums