Backing up automatically to Google Drive in Windows

  • Download Google Drive CLI Client by prasmussen
  • Copy to Windows folder
  • Open cmd > type : gdrive about
  • Open the link in web browser, login to your google account
  • Click allow access and then copy the verification code back to the terminal window
  • Now you can make a batch file to be started automatically using task scheduler, here’s an example to upload only the newest file in a folder :
    :Variables
    SET BackupFolder=D:\TestFolder
    FOR /F "delims=|" %%I IN ('DIR "%BackupFolder%\*.*" /B /O:D') DO SET target=%%I
    gdrive upload "%BackupFolder%\%target%"

PS: You can use this guide to set up a task in task scheduler

Automatic log off using ezlogoff in Windows

I don’t know why but using the default shutdown.exe to log off my computer automatically via task scheduler doesn’t seem to work. So I tried looking for alternative command line tool to do it, I found and tried ezlogoff, and I think it works perfectly. FYI it can do many things other than logging off, you can check out the documentations if you’re interested.

Here are the steps to set up the automatic logoff using ezlogoff :

  1. Download ezlogoff
  2. Copy ezlogoff.exe to C:\Windows
  3. Open task scheduler as administrator > new basic task
  4. Put this as the action : ezlogoff -m:"You will be logged out automatically in 3 minutes. Please save all your work, any unsaved changes will be lost." -t:180 -a -l
  5. Open properties after you’re done
  6. Check both “Run whether use is logged on or not” and “Run with highest privileges”
  7. Fix the triggers
  8. Conditions > power > uncheck “Start…” and “Stop…”