Stop Windows 10 Updates Properly and Completely

Page 32 of 37 FirstFirst ... 223031323334 ... LastLast

  1. Posts : 98
    Windows 10
       #311

    Pedro147 said:
    The Asian path name package is for what sorry ?
    Matthew, I hope you don't mind me answering this one.
    For some reason, and I've asked experts, it's impossible to create a task from a batch script or VBS file to create a task from an XML file if the path has non code page 1252 characters.

    If you use a variable in a script as the path name so that any path name will work, Asian characters are imported as invalid path names. I worked on this problem for countless hours with no good solution. One way is to make a symlink to the path but that's too messy for me since if someone moved the portable script folder you'd have invalid symlinks floating around. Another way is to use an 8.3 character path name but that also is too messy and unreliable because a path may not have an 8.3 name unless you delete and create the path in the script.

    Matthew Wai is using the only known good workaround.

    The only clean way to do it is to precisely name the Asian path name in the XML file to be used to create the task, and put the script in that path and never move it.

    In the wrapper script I detect a path name the script can't handle such as Asian path names, and I present an error message with this info:
    (path name) is an invalid path name. English and other Western European language characters allowed only. Move wrapper script folder to suitable path and run again. See Code Page 1252 Windows Latin 1 (ANSI) | Microsoft Docs for more information.

    Edit: This is what schtask.exe sees when it imports an xml to create a task in task scheduler with non code page 1252 characters in path name. Note the Russian (Загрузки) and Japanese (ダウンロード) "Download" folders displayed with "????"
    It corrupts the task execute path.

    Stop Windows 10 Updates Properly and Completely-wws-task-import-folder-foreign.png
    Last edited by pf100; 14 Feb 2019 at 04:34. Reason: Added picture for clarity
      My Computer


  2. Posts : 7,606
    Windows 10 Home 20H2
       #312

    pf100 said:
    The only clean way to do it is to precisely name the Asian path name in the XML file to be used to create the task, and put the script in that path and never move it.
    If you run my VBScript in this folder "...\♫ ♬ ♪ ♩ ♭ ♪ ♮ ❤★\", a correct path name will still be saved into the XML file. Try it out.
    I have just run it in "...\ダウンロード\", "...\다운로드\", "...\डाउनलोड\", and "...\تحميل\" ( in Japanese, Korean, Nepali, and Arabic respectively), and it also works.

    pf100 said:
    I've asked experts, it's impossible to create a task from a batch script or VBS file to create a task from an XML file if the path has Asian characters

    An expert answered my question here. My VBScript was created according to his answer.

    pf100 said:
    Matthew, I hope you don't mind me answering this one.
    This thread belongs to you. I am the one who has hijacked the thread.
    Last edited by Matthew Wai; 06 Feb 2019 at 02:39.
      My Computer


  3. Posts : 98
    Windows 10
       #313

    Matthew Wai said:
    If you run my VBScript in this folder "...\♫ ♬ ♪ ♩ ♭ ♪ ♮ ❤★\", a correct path name will still be saved into the XML file. Try it out.
    I have just run it in "...\ダウンロード\", "...\다운로드\", "...\डाउनलोड\", and "...\تحميل\" ( in Japanese, Korean, Nepali, and Arabic respectively), and it also works.


    An expert answered my question here. My VBScript was created according to his answer.


    This thread belongs to you. I am the one who has hijacked the thread.
    Excellent work. I'll definitely check it out.
      My Computer


  4. Posts : 38
    WinDoze 10 Home
       #314

    Thanks @pf100 I get the general idea

    Don't worry, the "general" in my reply is due to my low level on knowledge of all this rather than your reply.

    Those Stack Overflow guys know their stuff but aren't they sticklers for "The letter of the Stack Law"
      My Computer


  5. Posts : 98
    Windows 10
       #315

    I edited my post above to show what happens when you try to import an xml with non code page 1252 characters in the path name with schtask.exe in a batch or cmd script to create a task.
    Note the Russian (Загрузки) and Japanese (ダウンロード) "Download" folders displayed with "????"
    It corrupts the task execute path.

    Stop Windows 10 Updates Properly and Completely-wws-task-import-folder-foreign.png
      My Computer


  6. Posts : 7,606
    Windows 10 Home 20H2
       #316

    pf100 said:
    I edited my post above to show what happens when you try to import an xml with non code page 1252 characters in the path name with schtask.exe in a batch or cmd script to create a task.
    Could you post a link to download the .xml file, so that I can try it out?

    pf100 said:
    Note the Russian (Загрузки) and Japanese (ダウンロード) "Download" folders displayed with "????"
    It corrupts the task execute path.
    Both (Загрузки) and (ダウンロード) are displayed properly at my end. See the screenshot below:
    Attached Thumbnails Attached Thumbnails Stop Windows 10 Updates Properly and Completely-non-latin-1.jpg  
      My Computer


  7. Posts : 7,606
    Windows 10 Home 20H2
       #317

    @ Pedro147
    Next time when my VBScript has found an update which is not shown on Windows Update MiniTool, you can either exclude the update by the method described in my post #302 or install it after downloading it from Microsoft Update Catalog (enter the update title on the search bar).
      My Computer


  8. Posts : 98
    Windows 10
       #318

    Matthew Wai said:
    Could you post a link to download the .xml file, so that I can try it out?
    This is the part of the script that creates the xml using whatever path the script is in.
    Code:
    :: Create automatic Windows Defender Update "WDU" task that updates Defender only if it's enabled and running.
    set "Task_Name=WDU"
    ::    Create WDU.xml and import it as WDU task in task scheduler
    ::
    set "w=echo f.writeline "
    (
    echo Set Fso=CreateObject^("Scripting.FileSystemObject"^):Set f=Fso.CreateTextFile^(fso.GetSpecialFolder^(2^) ^& "\task.xml",True^)
    %w%"<?xml version=""1.0"" encoding=""UTF-16""?>"
    %w%"<Task version=""1.2"" xmlns=""http://schemas.microsoft.com/windows/2004/02/mit/task"">"
    %w%"<RegistrationInfo>"
    %w%"<Date>2016-02-18T08:29:39</Date>"
    %w%"<Author>pf100\rpo</Author>"
    %w%"<URI>\WDU</URI>"
    %w%"</RegistrationInfo>"
    %w%"<Triggers>"
    %w%"<CalendarTrigger>"
    %w%"<Repetition>"
    %w%"<Interval>PT6H</Interval>"
    %w%"<StopAtDurationEnd>false</StopAtDurationEnd>"
    %w%"</Repetition>"
    %w%"<StartBoundary>2016-05-12T00:01:00.0</StartBoundary>"
    %w%"<Enabled>true</Enabled>"
    %w%"<ScheduleByDay>"
    %w%"<DaysInterval>1</DaysInterval>"
    %w%"</ScheduleByDay>"
    %w%"</CalendarTrigger>"
    %w%"</Triggers>"
    %w%"<Principals>"
    %w%"<Principal id=""Author"">"
    %w%"<RunLevel>HighestAvailable</RunLevel>"
    %w%"</Principal>"
    %w%"</Principals>"
    %w%"<Settings>"
    %w%"<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>"
    %w%"<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>"
    %w%"<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>"
    %w%"<AllowHardTerminate>true</AllowHardTerminate>"
    %w%"<StartWhenAvailable>true</StartWhenAvailable>"
    %w%"<RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>"
    %w%"<IdleSettings>"
    %w%"<StopOnIdleEnd>false</StopOnIdleEnd>"
    %w%"<RestartOnIdle>false</RestartOnIdle>"
    %w%"</IdleSettings>"
    %w%"<AllowStartOnDemand>true</AllowStartOnDemand>"
    %w%"<Enabled>true</Enabled>"
    %w%"<Hidden>false</Hidden>"
    %w%"<RunOnlyIfIdle>false</RunOnlyIfIdle>"
    %w%"<WakeToRun>false</WakeToRun>"
    %w%"<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>"
    %w%"<Priority>7</Priority>"
    %w%"</Settings>"
    %w%"<Actions Context=""Author"">"
    %w%"<Exec>"
    %w%"<Command>""" ^& FSO.GetParentFolderName^(Wscript.ScriptFullName^) ^& "\%Task_Name%.cmd" ^& """</Command>"
    %w%"</Exec>"
    %w%"</Actions>"
    %w%"</Task>"
    echo f.Close
    )>"%~dp0task.vbs" &"%~dp0task.vbs" & del "%~dp0task.vbs"
    ::
    ::    Creating Windows Defender Update auto renewal task
    ::
    schtasks /delete /tn "%Task_Name%" /f >nul 2>&1
    schtasks /query /tn "%Task_Name%" >nul 2>&1 || (
        schtasks /create /tn "%Task_Name%" /ru "SYSTEM" /xml "%temp%\task.xml" >nul 2>&1) || (
    cls&echo.&echo Creating Windows Defender Update Auto-Renewal %Task_Name% task errored.&echo.&echo %~dp0 is invalid path name.&echo.&echo English and other Western European language characters allowed only.&echo.&echo Move wrapper script folder to suitable path and run again.&echo.&echo See https://msdn.microsoft.com/en-us/library/cc195054.aspx for more information.&echo.&echo Press any key to exit... & pause > nul &exit)
        del "%temp%\task.xml" >nul 2>&1)
    This is the xml created by the script if it's in the "C:\WUMT Wrapper Script" folder.
    See how at the bottom it's <Command>"C:\WUMT Wrapper Script\WDU.cmd"</Command>
    If I run the above code in a "Загрузки" or "ダウンロード folder, I get
    <Command>"C:\???????\WDU.cmd"</Command> and the task creation errors and fails because of the "%~dp0" variable in the vb script where it creates the xml to be imported puts garbage in the path name.

    Code:
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2016-02-18T08:29:39</Date>
        <Author>pf100\rpo</Author>
        <URI>\WDU</URI>
      </RegistrationInfo>
      <Triggers>
        <CalendarTrigger>
          <Repetition>
            <Interval>PT6H</Interval>
            <StopAtDurationEnd>false</StopAtDurationEnd>
          </Repetition>
          <StartBoundary>2016-05-12T00:01:00</StartBoundary>
          <Enabled>true</Enabled>
          <ScheduleByDay>
            <DaysInterval>1</DaysInterval>
          </ScheduleByDay>
        </CalendarTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>S-1-5-18</UserId>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>true</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>false</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>"C:\WUMT Wrapper Script\WDU.cmd"</Command>
        </Exec>
      </Actions>
    </Task>
    Matthew Wai said:
    Both (Загрузки) and (ダウンロード) are displayed properly at my end. See the screenshot below:
    (Загрузки) and (ダウンロード) are displayed properly for me in File Manager in Windows too. The screenshot of the ????? folders are from a dialog box of an installer that only understands code page 1252 characters, the same as the "%~dp0" variable that puts the bad path name in the xml which cause schtasks.exe to throw an error when it tries to import the bad path name in WDU.xml. I only used the screenshot to try to make it more clear why it's absolutely impossible for me to create an xml with a valid pathname in any language.

    I gave up before I tried
    Code:
    FOR %%A IN (%~dp0WDU.cmd) DO SET ExecCommand=%%~fsA
    to create the path. It might work, I don't know.
      My Computer


  9. Posts : 7,606
    Windows 10 Home 20H2
       #319

    pf100 said:
    If I run the above code in a "Загрузки" or "ダウンロード folder, I get
    <Command>"C:\???????\WDU.cmd"</Command> and the task creation errors and fails because of the "%~dp0" variable in the vb script where it creates the xml to be imported puts garbage in the path name.
    "%~dp0", the culprit causing errors, is absent from my VBScript, which will create an .xml file without garbage in the path name even if it is run in a "Загрузки" or "ダウンロード" folder at my end.
    Please click here to download my scripts.
    Put them in the said folders and run "Create WDU_task.cmd", which will run "Create WDU_XML.vbs" and then import the .xml files created with no errors.
    The paths shown in the .xml files are:
    <Command>"C:\Загрузки\WDU.cmd"</Command>
    <Command>"C:\ダウンロード\WDU.cmd"</Command>

    The paths shown in Task Scheduler are:
    Attached Thumbnails Attached Thumbnails Stop Windows 10 Updates Properly and Completely-.jpg   Stop Windows 10 Updates Properly and Completely-.jpg  
      My Computer


  10. Posts : 7,606
    Windows 10 Home 20H2
       #320

    pf100 said:
    the "%~dp0" variable that puts the bad path name in the xml which cause schtasks.exe to throw an error when it tries to import the bad path name in WDU.xml.
    In your script, the variable is "%~dp0", which creates a bad path name.
    In my script, the variable is split(wscript.scriptFullName, wscript.scriptname)(0), which does not create a bad path name.

    pf100 said:
    it's absolutely impossible for me to create an xml with a valid pathname in any language.
    It is impossible to do so via CMD script.
    It is possible to do so via VBScript.
    Is there a reason why you can only use CMD but not VBScript?
      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 21:37.
Find Us




Windows 10 Forums