I have tested an amended form of the batch file. It now does what I expected it to do. I suggest amending the batch file to include the additional line
del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"
I cannot know how many users have this alternative qmgr location. All I know is that both mine do & neither of them has the qmgr location given in the original batch file. I clean installed Windows 10 on both computers during August.
At the risk of boring you:-
1 The reason I thought something needed to be investigated was that, after running the original batch file [and the many similar ones such as the TechNet version], then manually running Settings, Updates it searched for updates even though it was not connected to the internet or to any other computers and produced results [a list of updates to be downloaded - the listed updates were those that had been found during a previous update search]. So I concluded that the previous queue had not been cleaned out by the batch file.So, the amended batch file successfully reset Windows update, including the update queue, whereas the original batch file did not.
2 After running an amended batch file that deleted the qmgr files in the alternative location, running Settings, Updates resulted in an almost immediate response that it couldn't connect to the update services [no list of updates was displayed]. This new behaviour makes sense because the computer was still not connected to the internet or any other computers.
The subject is of particular significance to me because I use a metered internet connection and I sometimes run Windows update to see if there is anything large enough to warrant going to the free & fast WiFi in my local library. I need to reset the update queue so that I can run Windows update from a clean start - otherwise it would continue with the existing list of updates and only afterwards would it bother to search for new ones [new ones that might supercede those that I have just wasted my time downloading & installing].