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>
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.