Windows cleverly uses git to realize automatic backup of notes
Today I suddenly discovered that you can use Gitee plus Windows scheduled tasks to realize automatic backup of notes on Windows , multi-terminal synchronization, and historical retrieval . The effect is very good. Let’s introduce it below:
Prepare git repository
Install git: https://git-scm.com/downloads:
Register and log in to gitee, generate the ssh key locally (Baidu for details), and then add it to gitee:
Create a new warehouse:
Fill in the saved folder name as the warehouse name:
Then open a Windows terminal and clone the repository:
git clone [email protected]:13132321/aaaa.git
Configure automatic upload script
After cloning is complete, put your notes into the folder and create a new one 自动上传.bat
:
%~d0
cd %~dp0
git pull
git add ./
git commit -m "Autosave: %date:~0,10% %time:~0,-3%"
git push
timeout /t 3
Double-click to run the test and the upload is successful:
You can see the update just uploaded. The commit content is the upload time:
Set up Windows automatic scheduled tasks
First open the window's task scheduler:
After opening, click once on the red box in the picture below:
Enter the task plan name:
Select the trigger time, with options such as daily, weekly, monthly, etc.:
Select trigger period:
Select a startup program :
Specify the script just now :
Click Finish, and then double-click the newly created scheduled task to adjust the execution cycle :
Finally, right-click to test whether it can be executed. If so, the script will be automatically executed regularly to save the notes :
It can be automatically saved. The automatic save is done:
references
1: window scheduled task_windows scheduled task_wandering worker's blog-CSDN blog
2: Bat script date and time acquisition_bat gets the current time_HMJ_'s blog-CSDN blog
If you have any questions or errors, please feel free to message me privately for corrections.
All rights reserved. Please do not reproduce without authorization!
Copyright © 2023.05 by Mr.Idleman. All rights reserved.