脚本如下:
进行cmd命令窗口
type kuaipan_daily_build_and_resource.bat
:: 是批处理的注释符号
echo "enter D,delete virtual machine's files and copy backup files"
rd /q /s D:\kuaipan_everyday_1 :: rd /q /s 永久删除(不进回收站)
rd /q /s D:\kuaipan_everyday_2
rd /q /s D:\kuaipan_everyday_3
xcopy /y /e D:\kuaipan_everyday_bak D:\ :: 复制文件夹
echo "enter E,starting new machine"
cd /d E:\vmware8
vmrun.exe -T ws start "D:\kuaipan_everyday_1\kuaipan_everyday_1.vmx"
timeout /t 6
vmrun.exe -T ws start "D:\kuaipan_everyday_2\kuaipan_everyday_2.vmx"
timeout /t 6
vmrun.exe -T ws start "D:\kuaipan_everyday_3\kuaipan_everyday_3.vmx"
timeout /t 6
echo "enter F,delete virtual machine's files and copy backup files"
rd /q /s F:\every-member
md F:\every-member :: 创建文件夹
xcopy /y /e F:\every-member-bak F:\every-member
echo "enter E,starting new machine"
cd /d E:\vmware8
vmrun.exe -T ws start "F:\every-member\three-machine\one\one.vmx"
timeout /t 6
vmrun.exe -T ws start "F:\every-member\three-machine\two\two.vmx"
timeout /t 6
vmrun.exe -T ws start "F:\every-member\three-machine\three\three.vmx"
exit
批处理:
del 删除文件命令/q/f强行删除不提示确定
rd 删除文件夹命令/q/s强行删除不提示确定
xcopy /y /e(/y:不提示直接覆盖 /e:复制目录和子目录,包括空的。)
设置windows计划任务---定时跑批处理脚本
1.控制面板--计划任务---右键点击新建任务
2 输入名称
3.新建触发器
4.添加批处理脚本