编写数据备份到公共网盘内的脚本
远程圆因现场设备,部署检测域网络的脚本和数据copy脚本
昨天写的数据copy脚本是针对共享文件夹的,针对copy公共网盘不起作用,只好另写脚本;
copytodomain.bat
1 2 3
| @echo off powershell -ExecutionPolicy Bypass -File D:\CES\copytodomain.ps1
|
copytodomain.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| $dateTimeFolderName = Get-Date -Format "yyyy-MM-dd" $remoteFolderPathdb = "\\172.169.101.10\软件文件\AGV\$dateTimeFolderName\db"
if (-not (Test-Path -Path $remoteFolderPathdb -PathType Container)) { New-Item -ItemType Directory -Path $remoteFolderPathdb -ErrorAction Stop Write-Host "文件夹 '$dateTimeFolderName' 已在 '$remoteFolderPathdb' 路径下创建。" } else { Write-Host "文件夹 '$dateTimeFolderName' 已存在。" } xcopy "D:\CES\db\*" "\\172.169.101.10\软件文件\AGV\$dateTimeFolderName\db" /s /e /i /y
$remoteFolderPathpdf = "\\172.169.101.10\软件文件\AGV\$dateTimeFolderName\pdf"
if (-not (Test-Path -Path $remoteFolderPathpdf -PathType Container)) { New-Item -ItemType Directory -Path $remoteFolderPathpdf -ErrorAction Stop Write-Host "文件夹 '$dateTimeFolderName' 已在 '$remoteFolderPathpdf' 路径下创建。" } else { Write-Host "文件夹 '$dateTimeFolderName' 已存在。" } xcopy "D:\CES\pdf\*" "\\172.169.101.10\软件文件\AGV\$dateTimeFolderName\pdf" /s /e /i /y
|
copytodomain.vbs
1 2 3 4
| Set WshShell = CreateObject("WScript.Shell") WshShell.Run "D:\CES\copytodomain.bat", 0 Set WshShell = Nothing
|
客户新需求: