I have written a batch script to perform some folder synchronizing task. I have scheduled the script to execute using task scheduler on events such as sleep/hibernate(kernel power event id 42) and shutdown (user32 event id 1074). The script is initiating on these events but it get stopped in between and computer goes to sleep/hibernate/shutdown and afterwards when I turned on the computer the script resumes. I want the script to complete first and then the computer should go off.
can someone provide me the solution to this or any alternate way to achieve the task.
This is the screenshot of my script test.bat This
This the modified script but it doesn't worked.
@echo OFF
set LogFile="C:\Users\Harsh Lulla\Desktop\TestLog.txt"
REM changing to High performance mode
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
powercfg /list >> %LogFile% 2>&1
echo %date% %time% Script Started. Running rclone sync command...>> %LogFile%
echo %date% %time% Syncing local system device with NAS... >> %LogFile%
rclone sync -n -v E:\test sftpNAS:/test/test >> %LogFile% 2>&1
echo %date% %time% rclone command completed. Script completed >> %LogFile%
REM changing to normal mode
powercfg /setactive 49ef8fc0-bb7f-488e-b6a0-f1fc77ec649b