Help with a .bat file.

Page 3 of 3 FirstFirst 123

  1. Posts : 17,636
    Windows 10 Pro
       #21

    EyeInTheSky said:
    If you look carefully back through the thread, you will see that my request was not strange at all because I caught a syntax error in my file; but as I mentioned, no results yet.
    There were no syntax errors in your batch file.

    Slash / and backslash \ can both be used in both Windows paths and URLs. It is just a general consensus to use slash in URLs and backslash in paths to better separate them in text. Any combination of slash and backslash can be used in same URL or path, even mixed.

    Example:

    You can access my Ten Forums profile with all following URLs:

    • https:\\www.tenforums.com\members\kari.html
    • https://www.tenforums.com/members/kari.html
    • https:\/www.tenforums.com\members/kari.html

    The same with the command told in this thread. It is absolutely, completely, profoundly irrelevant if you use slash instead of backslash as folder separator in a path.

    Kari
      My Computer


  2. Posts : 762
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.1706)
    Thread Starter
       #22

    Kari said:
    There were no syntax errors in your batch file.

    Slash / and backslash \ can both be used in both Windows paths and URLs. It is just a general consensus to use slash in URLs and backslash in paths to better separate them in text. Any combination of slash and backslash can be used in same URL or path, even mixed.

    Example:

    You can access my Ten Forums profile with all following URLs:

    • https:\\www.tenforums.com\members\kari.html
    • https://www.tenforums.com/members/kari.html
    • https:\/www.tenforums.com\members/kari.html

    The same with the command told in this thread. It is absolutely, completely, profoundly irrelevant if you use slash instead of backslash as folder separator in a path.

    Kari
    Then I'm left absolutely, completely and profoundly perplexed as to why even the tutorials just open the Windows Update interface but will not initiate the "Check for updates" function unless I manually click the button??????????

    In other words, perhaps not the wrong syntax, but rather I'm missing some syntax parameters in my code command lines I presume for a functioning .bat file to achieve what I'm after.
    Last edited by EyeInTheSky; 30 Oct 2018 at 09:58. Reason: Additional thoughts.
      My Computer


  3. Posts : 3,109
    Win10
       #23

    Sorry, if I missed it, but did you try try3's recommendation of starting the batch file as admin ?

    Help with a .bat file. - Windows 10 Forums
      My Computers


  4. Posts : 762
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.1706)
    Thread Starter
       #24

    das10 said:
    Sorry, if I missed it, but did you try try3's recommendation of starting the batch file as admin ?
    Yes, I tried it this way:

    Help with a .bat file.-admin.png

    Didn't work.

    Then the odd thing is that the advanced tab didn't allow me to set the property of always running it as administrator, it just had attributes:

    Help with a .bat file.-attributes.png

    I could make a shortcut of the batch file and enter advanced settings and apply "run as administrator" always on the shortcut; but I don't know if that will solve anything.

    In Windows 7, this was simple and easy to assign a batch file to Windows Update to fully automate it to force "Check for updates and install if you wanted to as well. You could virtually control Windows Update with one click; so long as you had the "one click option" selected in "Folder Options" of the Control Panel".
      My Computer


  5. Posts : 505
    Windows 10 Home
       #25

    I'm getting intermittent results as well. This always seems to work although it sometimes checks twice.

    %windir%\explorer.exe ms-settings:windowsupdate-action
    timeout 5
    %windir%\explorer.exe ms-settings:windowsupdate-action

    If you would rather have it work in the background, try "usoclient StartScan".

    Incidentally, I tried using "%windir%\explorer.exe ms-settings:windowsupdate-action" while Windows was waiting for a restart on KB4462933 and it actually restarted the computer without even giving me a chance to close my programs. No harm done, but I wasn't expecting it. Usoclient may or may not do this, but I have no way of testing it at the moment.

    Ben
      My Computer


  6. Posts : 762
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.1706)
    Thread Starter
       #26

    Ben Myers said:
    I'm getting intermittent results as well. This always seems to work although it sometimes checks twice.

    %windir%\explorer.exe ms-settings:windowsupdate-action
    timeout 5
    %windir%\explorer.exe ms-settings:windowsupdate-action

    If you would rather have it work in the background, try "usoclient StartScan".

    Incidentally, I tried using "%windir%\explorer.exe ms-settings:windowsupdate-action" while Windows was waiting for a restart on KB4462933 and it actually restarted the computer without even giving me a chance to close my programs. No harm done, but I wasn't expecting it. Usoclient may or may not do this, but I have no way of testing it at the moment.

    Ben
    Awesome!

    This worked:

    %windir%\explorer.exe ms-settings:windowsupdate-action
    timeout 5
    %windir%\explorer.exe ms-settings:windowsupdate-action

    Batch file looks like this:

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

    Now I wonder if I could possibly go a step further, and have it auto close the Updates interface after it starts the check for updates?

    But, as of now, I'm very grateful for yours and others help on this matter.
      My Computer


  7. Posts : 505
    Windows 10 Home
       #27

    The only thing that comes to mind for closing the window is taskkill, but it is typically only used on processes that are malfunctioning or shouldn't be running in the first place. It might be helpful to know what you are trying to accomplish, since you can use usoclient to trigger an update scan without opening the settings window.

    Ben
      My Computer


  8. Posts : 762
    Windows 10 Home x64 - Version 21H2 (OS Build 19044.1706)
    Thread Starter
       #28

    Ben Myers said:
    The only thing that comes to mind for closing the window is taskkill, but it is typically only used on processes that are malfunctioning or shouldn't be running in the first place. It might be helpful to know what you are trying to accomplish, since you can use usoclient to trigger an update scan without opening the settings window.

    Ben
    Thanks Ben. You are right and I figured it out. This is exactly line for line what my batch looks like:

    Code:
    %windir%\explorer.exe ms-settings:windowsupdate-action
    timeout 1
    %windir%\explorer.exe ms-settings:windowsupdate-action
    timeout 5
    taskkill /F /IM SystemSettings.exe
    This is what I was trying to accomplish and succeeded.

    Click the batch file from desktop:

    1- It opens the cmd window and pastes the commands from the batch; then closes the cmd window at the end of the second timeout.
    2- It opens the Windows Update interface and begins checking for updates.
    3- After 5 seconds, it closes the Updates interface (and cmd window) but still continues to check for updates.

    I confirmed it was still checking for updates after it task killed the updates window interface just to be sure the process of checking for updates itself was not terminated by reopening Windows Update normally - it was still checking! Awesome because of your code line in the batch - hats off to you!

    I confirmed the time checked with the computer time and it worked flawlessly.

    Since I don't defer any Windows Updates, I found this one click method of the batch file to be extremely useful; especially when I manually force a check for updates instead of waiting how many hours it waits between auto checking for updates.

    The UsoClient did not have any results in my batch; plus I like to see that the updates process actually started in the interface window.

    So I'm all set. It does this all from one click because I have the "one click" option selected in my Folder Options. Now I don't have to click more than once to check for updates manually.

    Thanks again Ben!
    Last edited by EyeInTheSky; 31 Oct 2018 at 23:32. Reason: Additional thoughts in closing.
      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 06:53.
Find Us




Windows 10 Forums