==Shutdown when robocopy ends== This is a windows command line script that shutdowns computer if robocopy is not in the task list. Otherwise, it keeps waiting until robocopy ends -- when it is removed from the task list. This way, we can start robocopy at night, and before going to bed, execute this script to shutdown computer when robocopy ends. rem Save this file as: rem shutdown-when-robocopy-ends.cmd rem and execute it AFTER starting robocopy. rem (otherwise your computer will shut down!) rem :beginning tasklist | find /i "robocopy" > estado_robocopy for %%a in (robocopy_state) do if %%~za.==0. goto :turnoff for /L %%f in (1;1;10000) do rem %%f goto :beginning :turnoff shutdown -s -t 200 @echo ************************************** @echo TO CANCEL, open a Command line and type @echo Shutdown -a :end