• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Wakeup/Boot ScheduledTask: throttleStopOnWakeUp.bat

isidroco

New Member
Joined
Apr 10, 2023
Messages
9 (0.01/day)
Location
argentina
I made a batch that generates INI file to lower voltage to -90mV (if previous INI not present or NEW parameter is used) and creates a Scheduled Task that will run ThrottleStop.EXE after few seconds of Wakeup/resume from sleep/hibernate, and at boot. ThrottleStop will only run for 20 seconds (windows will kill it, no need to use inner ExitTime INI setting). Some help provided within batch. Will ask for admin rights if needed.

Code:
@echo off

  rem BD procHot default enabled: 0x00300020;  disabled: 0x00300000
set procHot=0x00300020
  rem mVolt -49.8 -60.5      -70.3      -80.1      -89.8      -100.6     -110.4     -120.1     -125
  rem 0xF9B00000 0xF8400000 0xF7100000 0xF5C00000 0xF4800000 0xF3200000 0xF1E00000 0xF0A00000 0xF0000000
set voltage=0xF4800000

echo .
echo . throttleStopOnWakeUp.bat v23.0412 by isidroco
echo .
echo . Creates ThrottleStop.exe scheduled task on logon/wakeup
echo . Parameters:
echo .   new: Generates ThrottleStop.ini with -90mV
echo .   nopause: self described
echo .
echo .   Needs throttleStop.exe and win7 or later
echo .   BDProcHot and Voltage can be changed in first lines
echo .   Will autorequire admin privileges if needed
echo .
echo .

setlocal enableextensions enabledelayedexpansion & REM to get var value at exec with !varNm!

set PARAM=%* _& REM _ avoid PARAM being empty if no param passed, %* are rest of parameters passed
rem set PARAM=%PARAM: =%& REM delete all spaces
rem echo PARAM:!PARAM!

  REM Run as admin; https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator/12264592#12264592
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
   REM  ELEVATE PRIVILEGES AND SELF-RUN AGAIN
   powershell Start-Process -FilePath "%0" -ArgumentList "%PARAM%" -verb runas >NUL 2>NUL
   exit /b
)
  rem Verify Admin rights
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
    echo . Must execute as administrator  !!!
    goto :PAUSEFIN
)
  REM Change directory to current script. "runas" starts in C:\Windows\System32
cd /d %~dp0
REM echo Current path is %cd%

  rem Find EXE: try 1st batch path, try then with FOR dir list
echo . 1- Locate EXE
set throttleDir=%homedrive%:\UT\Info\
FOR %%P in ( "%cd%" "%homedrive%:\UT" "%throttleDir%" ) do (
  set "throttleDir=%%~P"& REM eliminate outside quotes"
  rem echo !throttleDir!
  IF exist "!throttleDir!\ThrottleStop.exe" GOTO :throttleFound
  )
  echo .   ThrottleStop.exe not found
  goto :PAUSEFIN
:throttleFound
echo .   Found OK: !throttleDir!\ThrottleStop.exe
echo .

  rem new parameter generates a new ini, old one moved to in0
IF not "%PARAM:new=%"=="%PARAM%" if exist "!throttleDir!\ThrottleStop.ini" (
  echo .   Move original .ini to .in0
  del "!throttleDir!\ThrottleStop.in0" 2>nul
  ren "!throttleDir!\ThrottleStop.ini" *.in0
)

IF exist "!throttleDir!\ThrottleStop.ini" (
  echo . 2- INI Already present !throttleDir!\ThrottleStop.ini
) else (
  echo . 2- Generating "!throttleDir!\ThrottleStop.ini" temp file
  (
  echo\[ThrottleStop]
  echo\Options1=!procHot!
  echo\;ExitTime=15
  echo\FIVRVoltage00=!voltage!
  echo\FIVRVoltage20=!voltage!
  echo\UnlockVoltage00=1
  echo\UnlockVoltage20=1
  ) > "!throttleDir!\ThrottleStop.ini"
  echo .   Generated new INI file
)
echo .

echo . 3- Generating XML task description temp file
  (
  echo\^<?xml version="1.0" encoding="UTF-16"?^>
  echo\^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
  echo\  ^<RegistrationInfo^>
  echo\    ^<Date^>2023-04-12T11:04:36.8708211^</Date^>
  echo\    ^<Author^>isidroco^</Author^>
  echo\    ^<Description^>Saves energy, reduces throtling by lowering CPU voltage, runs on wakeup and boot for 20 seconds^</Description^>
  echo\    ^<URI^>\throttleStopOnWakeUp^</URI^>
  echo\  ^</RegistrationInfo^>
  echo\  ^<Triggers^>
  echo\    ^<BootTrigger^>
  echo\      ^<Enabled^>true^</Enabled^>
  echo\      ^<Delay^>PT16S^</Delay^>
  echo\    ^</BootTrigger^>
  echo\    ^<EventTrigger^>
  echo\      ^<Enabled^>true^</Enabled^>
  echo\      ^<Subscription^>^&lt;QueryList^&gt;^&lt;Query Id="0" Path="System"^&gt;^&lt;Select Path="System"^&gt;*[System[Provider[@Name='Microsoft-Windows-Kernel-General'] and EventID=1]]^&lt;/Select^&gt;^&lt;/Query^&gt;^&lt;/QueryList^&gt;^</Subscription^>
  echo\      ^<Delay^>PT11S^</Delay^>
  echo\    ^</EventTrigger^>
  echo\  ^</Triggers^>
  echo\  ^<Principals^>
  echo\    ^<Principal id="Author"^>
  echo\      ^<RunLevel^>LeastPrivilege^</RunLevel^>
  echo\      ^<UserId^>S-1-5-18^</UserId^>
  echo\    ^</Principal^>
  echo\  ^</Principals^>
  echo\  ^<Settings^>
  echo\    ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
  echo\    ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
  echo\    ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
  echo\    ^<AllowHardTerminate^>true^</AllowHardTerminate^>
  echo\    ^<StartWhenAvailable^>false^</StartWhenAvailable^>
  echo\    ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
  echo\    ^<IdleSettings^>
  echo\      ^<StopOnIdleEnd^>false^</StopOnIdleEnd^>
  echo\      ^<RestartOnIdle^>false^</RestartOnIdle^>
  echo\    ^</IdleSettings^>
  echo\    ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
  echo\    ^<Enabled^>true^</Enabled^>
  echo\    ^<Hidden^>false^</Hidden^>
  echo\    ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
  echo\    ^<WakeToRun^>false^</WakeToRun^>
  echo\    ^<ExecutionTimeLimit^>PT20S^</ExecutionTimeLimit^>
  echo\    ^<Priority^>7^</Priority^>
  echo\  ^</Settings^>
  echo\  ^<Actions Context="Author"^>
  echo\    ^<Exec^>
  echo\      ^<Command^>!throttleDir!\ThrottleStop.exe^</Command^>
  echo\    ^</Exec^>
  echo\  ^</Actions^>
  echo\^</Task^>
) > "!TEMP!\throtleTemp.xml"
echo .

echo . 4- Creating throttleStopOnWakeUp task
echo .    triggered on startup and wakeup (when time gets resynched)
echo .    task is killed by system after 20 seconds
SCHTASKS /create /tn throttleStopOnWakeUp /f ^
  /xml "!TEMP!\throtleTemp.xml" /ru SYSTEM ^
  && echo .   * ok Create throttleStopOnWakeUp Task ^
  || echo .   *** ERROR creating throttleStopOnWakeUp Task
echo .
  rem SCHTASKS /create /tn throttleStopOnWakeUp /f /tr "c:\UT\Info\ThrottleStop.exe" ^
  rem  /ru SYSTEM /rl highest /delay 0000:15 /sc onlogon


IF "%PARAM:nodel=%"=="%PARAM%" (
  echo . 5- deleting temporary "!TEMP!\throtleTemp.xml" file
  del "!TEMP!\throtleTemp.xml"
  echo .
)
echo .

echo .   All Done
echo .

:PAUSEFIN
IF "%PARAM:nopause=%"=="%PARAM%" pause
:FIN
 
Last edited:

isidroco

New Member
Joined
Apr 10, 2023
Messages
9 (0.01/day)
Location
argentina
Small improvement of same batch: only create task if "task" parameter is included:

Code:
@echo off

  rem https://www.techpowerup.com/forums/threads/wakeup-boot-scheduledtask-throttlestoponwakeup-bat.307169/
  rem BD procHot default enabled: 0x00300020;  disabled: 0x00300000
set procHot=0x00300020
  rem mVolt -49.8 -60.5      -70.3      -80.1      -89.8      -100.6     -110.4     -120.1     -125
  rem 0xF9B00000 0xF8400000 0xF7100000 0xF5C00000 0xF4800000 0xF3200000 0xF1E00000 0xF0A00000 0xF0000000
set voltage=0xF4800000

echo .
echo . throttleStopOnWakeUp.bat v23.0412 by isidroco
echo .
echo . Creates ThrottleStop.exe scheduled task on logon/wakeup
echo . Parameters:
echo .   task: Generates ThrottleStop task
echo .   new: Generates ThrottleStop.ini with -90mV
echo .   nopause: self described
echo .
echo .   Needs throttleStop.exe, win7 or later, CPU intel gen4 or later
echo .   BDProcHot and Voltage can be changed in first lines
echo .   Will autorequire admin privileges if needed
echo .
echo .

setlocal enableextensions enabledelayedexpansion & REM to get var value at exec with !varNm!

set PARAM=%* _& REM _ avoid PARAM being empty if no param passed, %* are rest of parameters passed
rem set PARAM=%PARAM: =%& REM delete all spaces
rem echo PARAM:!PARAM!

  REM Run as admin; https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator/12264592#12264592
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
   REM  ELEVATE PRIVILEGES AND SELF-RUN AGAIN
   powershell Start-Process -FilePath "%0" -ArgumentList "%PARAM%" -verb runas >NUL 2>NUL
   exit /b
)
  rem Verify Admin rights
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
    echo . Must execute as administrator  !!!
    goto :PAUSEFIN
)
  REM Change directory to current script. "runas" starts in C:\Windows\System32
cd /d %~dp0
REM echo Current path is %cd%

  rem Find EXE: try 1st batch path, try then with FOR dir list
echo . 1- Locate EXE
set throttleDir=%homedrive%:\UT\Info\
FOR %%P in ( "%cd%" "%homedrive%:\UT" "%throttleDir%" ) do (
  set "throttleDir=%%~P"& REM eliminate outside quotes"
  rem echo !throttleDir!
  IF exist "!throttleDir!\ThrottleStop.exe" GOTO :throttleFound
  )
  echo .   ThrottleStop.exe not found
  goto :PAUSEFIN
:throttleFound
echo .   Found OK: !throttleDir!\ThrottleStop.exe
echo .

  rem new parameter generates a new ini, old one moved to in0
IF not "%PARAM:new=%"=="%PARAM%" if exist "!throttleDir!\ThrottleStop.ini" (
  echo .   Move original .ini to .in0
  del "!throttleDir!\ThrottleStop.in0" 2>nul
  ren "!throttleDir!\ThrottleStop.ini" *.in0
)

IF exist "!throttleDir!\ThrottleStop.ini" (
  echo . 2- INI Already present !throttleDir!\ThrottleStop.ini
) else (
  echo . 2- Generating "!throttleDir!\ThrottleStop.ini" temp file
  (
  echo\[ThrottleStop]
  echo\Options1=!procHot!
  echo\;ExitTime=15
  echo\FIVRVoltage00=!voltage!
  echo\FIVRVoltage20=!voltage!
  echo\UnlockVoltage00=1
  echo\UnlockVoltage20=1
  ) > "!throttleDir!\ThrottleStop.ini"
  echo .   Generated new INI file
)
echo .

IF not "%PARAM:task=%"=="%PARAM%" if exist "!throttleDir!\ThrottleStop.ini" (

  echo . 3- Generating XML task description temp file
    (
    echo\^<?xml version="1.0" encoding="UTF-16"?^>
    echo\^<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
    echo\  ^<RegistrationInfo^>
    echo\    ^<Date^>2023-04-12T11:04:36.8708211^</Date^>
    echo\    ^<Author^>isidroco^</Author^>
    echo\    ^<Description^>Saves energy, reduces throtling by lowering CPU voltage, runs on wakeup and boot for 20 seconds^</Description^>
    echo\    ^<URI^>\throttleStopOnWakeUp^</URI^>
    echo\  ^</RegistrationInfo^>
    echo\  ^<Triggers^>
    echo\    ^<BootTrigger^>
    echo\      ^<Enabled^>true^</Enabled^>
    echo\      ^<Delay^>PT16S^</Delay^>
    echo\    ^</BootTrigger^>
    echo\    ^<EventTrigger^>
    echo\      ^<Enabled^>true^</Enabled^>
    echo\      ^<Subscription^>^&lt;QueryList^&gt;^&lt;Query Id="0" Path="System"^&gt;^&lt;Select Path="System"^&gt;*[System[Provider[@Name='Microsoft-Windows-Kernel-General'] and EventID=1]]^&lt;/Select^&gt;^&lt;/Query^&gt;^&lt;/QueryList^&gt;^</Subscription^>
    echo\      ^<Delay^>PT11S^</Delay^>
    echo\    ^</EventTrigger^>
    echo\  ^</Triggers^>
    echo\  ^<Principals^>
    echo\    ^<Principal id="Author"^>
    echo\      ^<RunLevel^>LeastPrivilege^</RunLevel^>
    echo\      ^<UserId^>S-1-5-18^</UserId^>
    echo\    ^</Principal^>
    echo\  ^</Principals^>
    echo\  ^<Settings^>
    echo\    ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
    echo\    ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
    echo\    ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
    echo\    ^<AllowHardTerminate^>true^</AllowHardTerminate^>
    echo\    ^<StartWhenAvailable^>false^</StartWhenAvailable^>
    echo\    ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
    echo\    ^<IdleSettings^>
    echo\      ^<StopOnIdleEnd^>false^</StopOnIdleEnd^>
    echo\      ^<RestartOnIdle^>false^</RestartOnIdle^>
    echo\    ^</IdleSettings^>
    echo\    ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
    echo\    ^<Enabled^>true^</Enabled^>
    echo\    ^<Hidden^>false^</Hidden^>
    echo\    ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
    echo\    ^<WakeToRun^>false^</WakeToRun^>
    echo\    ^<ExecutionTimeLimit^>PT20S^</ExecutionTimeLimit^>
    echo\    ^<Priority^>7^</Priority^>
    echo\  ^</Settings^>
    echo\  ^<Actions Context="Author"^>
    echo\    ^<Exec^>
    echo\      ^<Command^>!throttleDir!\ThrottleStop.exe^</Command^>
    echo\    ^</Exec^>
    echo\  ^</Actions^>
    echo\^</Task^>
  ) > "!TEMP!\throtleTemp.xml"
  echo .

  echo . 4- Creating throttleStopOnWakeUp task
  echo .    triggered on startup and wakeup (when time gets resynched^)
  echo .    task is killed by system after 20 seconds
  SCHTASKS /create /tn throttleStopOnWakeUp /f ^
    /xml "!TEMP!\throtleTemp.xml" /ru SYSTEM ^
    && echo .   * ok Create throttleStopOnWakeUp Task ^
    || echo .   *** ERROR creating throttleStopOnWakeUp Task
  echo .
    rem SCHTASKS /create /tn throttleStopOnWakeUp /f /tr "c:\UT\Info\ThrottleStop.exe" ^
    rem  /ru SYSTEM /rl highest /delay 0000:15 /sc onlogon


  IF "%PARAM:nodel=%"=="%PARAM%" (
    echo . 5- deleting temporary "!TEMP!\throtleTemp.xml" file
    del "!TEMP!\throtleTemp.xml"
    echo .
  )
  echo .

)

echo .   All Done
echo .

:PAUSEFIN
IF "%PARAM:nopause=%"=="%PARAM%" pause
:FIN
 

isidroco

New Member
Joined
Apr 10, 2023
Messages
9 (0.01/day)
Location
argentina
Useful addition right before "All Done" (to set max privileges) and ensure execution:

echo . 6- set throttleStopOnWakeUp max privileges
schtasks /change /tn "throttleStopOnWakeUp" /rl Highest
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
27,979 (3.71/day)
Processor Ryzen 7 5700X
Memory 48 GB
Video Card(s) RTX 4080
Storage 2x HDD RAID 1, 3x M.2 NVMe
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
Nice work, this should be easily adaptable to other users' needs
 

isidroco

New Member
Joined
Apr 10, 2023
Messages
9 (0.01/day)
Location
argentina
Nice work, this should be easily adaptable to other users' needs
Thanks, my last version added trigger on user logon, and minor mods to make sure task is executed. Here it is:

Code:
@echo off

  rem https://www.techpowerup.com/forums/threads/wakeup-boot-scheduledtask-throttlestoponwakeup-bat.307169/
  rem BD procHot default enabled: 0x00300020;  disabled: 0x00300000
set procHot=0x00300020
  rem mVolt -49.8 -60.5      -70.3      -80.1      -89.8      -100.6     -110.4     -120.1     -125
  rem 0xF9B00000 0xF8400000 0xF7100000 0xF5C00000 0xF4800000 0xF3200000 0xF1E00000 0xF0A00000 0xF0000000
set voltage=0xF8400000

echo .
echo . throttleStopOnWakeUp.bat v24.0705 by isidroco
echo .
echo . Creates ThrottleStop.exe scheduled task on logon/wakeup
echo . Parameters:
echo .   task: Generates ThrottleStop task
echo .   new: Generates ThrottleStop.ini with -60mV
echo .   noDel: Keep temp XML task file: "%TEMP%!\throtleTemp.xml"
echo .   noPause: self described
echo .
echo .   Needs throttleStop.exe, win7 or later, CPU intel gen4 or later
echo .   BDProcHot and Voltage can be changed in first lines
echo .   Will autorequire admin privileges if needed
echo .
echo .

setlocal enableextensions enabledelayedexpansion & REM to get var value at exec with !varNm!

set PARAM=%* _& REM _ avoid PARAM being empty if no param passed, %* are rest of parameters passed
rem set PARAM=%PARAM: =%& REM delete all spaces
rem echo PARAM:!PARAM!

  REM Run as admin; https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator/12264592#12264592
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
   REM  ELEVATE PRIVILEGES AND SELF-RUN AGAIN
   powershell Start-Process -FilePath "%0" -ArgumentList "%PARAM%" -verb runas >NUL 2>NUL
   exit /b
)
  rem Verify Admin rights
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
    echo . Must execute as administrator  !!!
    goto :PAUSEFIN
)
  REM Change directory to current script. "runas" starts in C:\Windows\System32
cd /d %~dp0
REM echo Current path is %cd%

  rem Find EXE: try 1st batch path, try then with FOR dir list
echo . 1- Locate EXE
set throttleDir=%homedrive%:\UT\Info\
FOR %%P in ( "%cd%" "%homedrive%:\UT" "%throttleDir%" ) do (
  set "throttleDir=%%~P"& REM eliminate outside quotes"
  rem echo !throttleDir!
  IF exist "!throttleDir!\ThrottleStop.exe" GOTO :throttleFound
  )
  echo .   ThrottleStop.exe not found
  goto :PAUSEFIN
:throttleFound
echo .   Found OK: !throttleDir!\ThrottleStop.exe
echo .

  rem new parameter generates a new ini, old one moved to in0
IF not "%PARAM:new=%"=="%PARAM%" if exist "!throttleDir!\ThrottleStop.ini" (
  echo .   Move original .ini to .in0
  del "!throttleDir!\ThrottleStop.in0" 2>nul
  ren "!throttleDir!\ThrottleStop.ini" *.in0
)

IF exist "!throttleDir!\ThrottleStop.ini" (
  echo . 2- INI Already present !throttleDir!\ThrottleStop.ini
) else (
  echo . 2- Generating "!throttleDir!\ThrottleStop.ini" temp file
  (
  echo\[ThrottleStop]
  echo\Options1=!procHot!
  echo\;ExitTime=25
  echo\FIVRVoltage00=!voltage!
  echo\FIVRVoltage20=!voltage!
  echo\UnlockVoltage00=1
  echo\UnlockVoltage20=1
  ) > "!throttleDir!\ThrottleStop.ini"
  echo .   Generated new INI file
)
echo .

IF not "%PARAM:task=%"=="%PARAM%" if exist "!throttleDir!\ThrottleStop.ini" (

  echo . 3- Generating XML task description temp file
    (
    echo\^<?xml version="1.0" encoding="UTF-16"?^>
    echo\^<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"^>
    echo\  ^<RegistrationInfo^>
    echo\    ^<Date^>2023-07-05T11:04:36.8708211^</Date^>
    echo\    ^<Author^>isidroco^</Author^>
    echo\    ^<Description^>Saves energy, reduces throtling by lowering CPU voltage, runs on boot/wakeup and exits^</Description^>
    echo\    ^<URI^>\throttleStopOnWakeUp^</URI^>
    echo\  ^</RegistrationInfo^>
    echo\  ^<Triggers^>
    echo\    ^<BootTrigger^>
    echo\      ^<Enabled^>true^</Enabled^>
    echo\      ^<Delay^>PT55S^</Delay^>
    echo\    ^</BootTrigger^>
    echo\    ^<EventTrigger^>
    echo\      ^<Enabled^>true^</Enabled^>
    echo\      ^<Subscription^>^&lt;QueryList^&gt;^&lt;Query Id="0" Path="System"^&gt;^&lt;Select Path="System"^&gt;*[System[Provider[@Name='Microsoft-Windows-Kernel-General'] and EventID=1]]^&lt;/Select^&gt;^&lt;/Query^&gt;^&lt;/QueryList^&gt;^</Subscription^>
    echo\      ^<Delay^>PT11S^</Delay^>
    echo\    ^</EventTrigger^>
    echo\    ^<LogonTrigger^>
    echo\      ^<Enabled^>true^</Enabled^>
    echo\      ^<Delay^>PT1M15S^</Delay^>
    echo\    ^</LogonTrigger^>
    echo\  ^</Triggers^>
    echo\  ^<Principals^>
    echo\    ^<Principal id="Author"^>
    echo\      ^<RunLevel^>HighestAvailable^</RunLevel^>
    echo\      ^<UserId^>S-1-5-18^</UserId^>
    echo\    ^</Principal^>
    echo\  ^</Principals^>
    echo\  ^<Settings^>
    echo\    ^<MultipleInstancesPolicy^>IgnoreNew^</MultipleInstancesPolicy^>
    echo\    ^<DisallowStartIfOnBatteries^>false^</DisallowStartIfOnBatteries^>
    echo\    ^<StopIfGoingOnBatteries^>false^</StopIfGoingOnBatteries^>
    echo\    ^<AllowHardTerminate^>true^</AllowHardTerminate^>
    echo\    ^<StartWhenAvailable^>true^</StartWhenAvailable^>
    echo\    ^<RunOnlyIfNetworkAvailable^>false^</RunOnlyIfNetworkAvailable^>
    echo\    ^<IdleSettings^>
    echo\      ^<StopOnIdleEnd^>false^</StopOnIdleEnd^>
    echo\      ^<RestartOnIdle^>false^</RestartOnIdle^>
    echo\    ^</IdleSettings^>
    echo\    ^<AllowStartOnDemand^>true^</AllowStartOnDemand^>
    echo\    ^<Enabled^>true^</Enabled^>
    echo\    ^<Hidden^>false^</Hidden^>
    echo\    ^<RunOnlyIfIdle^>false^</RunOnlyIfIdle^>
    echo\    ^<DisallowStartOnRemoteAppSession^>false^</DisallowStartOnRemoteAppSession^>
    echo\    ^<UseUnifiedSchedulingEngine^>true^</UseUnifiedSchedulingEngine^>
    echo\    ^<WakeToRun^>false^</WakeToRun^>
    echo\    ^<ExecutionTimeLimit^>PT39S^</ExecutionTimeLimit^>
    echo\    ^<Priority^>7^</Priority^>
    echo\  ^</Settings^>
    echo\  ^<Actions Context="Author"^>
    echo\    ^<Exec^>
    echo\      ^<Command^>!throttleDir!\ThrottleStop.exe^</Command^>
    echo\    ^</Exec^>
    echo\  ^</Actions^>
    echo\^</Task^>
  ) > "%TEMP%\throtleTemp.xml"
  echo .

  echo . 4- Creating throttleStopOnWakeUp task
  echo .    triggered on startup and wakeup (when time gets resynched^)
  echo .    task is killed by system after 34 seconds
  SCHTASKS /create /tn throttleStopOnWakeUp /f ^
    /xml "%TEMP%\throtleTemp.xml" /ru SYSTEM ^
    && echo .   * ok Create throttleStopOnWakeUp Task ^
    || echo .   *** ERROR creating throttleStopOnWakeUp Task
  echo .
    rem SCHTASKS /create /tn throttleStopOnWakeUp /f /tr "c:\UT\Info\ThrottleStop.exe" ^
    rem  /ru SYSTEM /rl highest /delay 0000:15 /sc onlogon


  IF "%PARAM:nodel=%"=="%PARAM%" (
    echo . 5- deleting temporary "%TEMP%\throtleTemp.xml" file
    del "%TEMP%\throtleTemp.xml"
    echo .
  )
  echo .

)

echo . 6- set throttleStopOnWakeUp max privileges
schtasks /change /tn "throttleStopOnWakeUp" /rl Highest

echo .   All Done
echo .

:PAUSEFIN
IF "%PARAM:nopause=%"=="%PARAM%" pause
:FIN
 
Top