开启powershell执行权限
Set-ExecutionPolicy RemoteSigned
#用途:用于备份wiki代码和数据
#时间:2017-2-15
#
$local_backup_dir="C:\xampp\htdocs\wiki\data\backup\"
$today=get-date -format "yyyy-M-d"
new-item -path C:\local_backup -name $today -type directory
new-item -path \\172.16.3.35\数据备份wiki -name $today -type directory
cmd /c "C:\xampp\mysql\bin\mysqldump.exe -uroot -p123456 --databases wiki >"$local_backup_dir"wiki"$today".sql"
Copy-Item -Recurse C:\xampp\htdocs\wiki C:\local_backup\$today\
Copy-Item -Recurse C:\xampp\htdocs\wiki \\172.16.3.35\数据备份wiki\$today\
添加到计划任务