我已经为我们网络上的域用户设置了一个在计算机关闭时运行的Robocopy脚本。这个想法是将用户文件夹备份到NAS,以防用户没有使用映射的网络驱动器来处理办公室数据。
我没有使用文件夹重定向或漫游配置文件,因为数据不是关键任务,我不想在启动期间同步文件夹的延迟。而且只有一些东西最好在本地运行而不是从网络运行。
因此用户完成,关闭他们的计算机并且脚本在后台运行。问题在于,一些勤奋工作的员工徘徊在一起,以确保计算机正常关闭,可怜的员工站在那里,认为计算机在脚本支持数据时已经冻结。
有没有办法让下面的脚本显示文件副本的进度? 甚至可能是一条消息说"您的用户配置文件正在备份。备份完成后,计算机将完成关机过程。"
@ECHO OFF
SETLOCAL
Set day=%DATE:~7,2%
Set mm=%DATE:~4,2%
Set dd=%DATE:~7,2%
Set yyyy=%DATE:~10,4%
Set RCLogFile=C:\backup-logs\%yyyy%%mm%%dd%_-_FileSync-Log.txt
SET _what=/MIR /COPY:DAT /DCOPY:T
:: /COPY:DAT :: COPY ALL file info
:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /MIR :: MIRror a directory tree
SET _options=/R:0 /W:1 /FP /NDL /NP /TEE /XF "desktop.ini" ".DS_Store" "._Temporary Items" "._TemporaryItems" "*..RF" "thumbs.db" /XD ".AppleFileInfo" "Network Trash Folder" "TheFindByContentFolder" "TheVolumeSettingsFolder" "Temporary Items" "TemporaryItems"
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NDL :: No directory logging
:: /NP :: No % percentage logging
MD C:\backup-logs
ROBOCOPY "%userprofile%\Contacts" H:\Computer_Backup\Contacts %_what% %_options% /LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Desktop" H:\Computer_Backup\Desktop %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Documents" H:\Computer_Backup\Documents %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Downloads" H:\Computer_Backup\Downloads %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Favorites" H:\Computer_Backup\Favorites %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Links" H:\Computer_Backup\Links %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Music" H:\Computer_Backup\Music %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\Pictures" H:\Computer_Backup\Videos %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\AppData\Roaming\Microsoft\Outlook" H:\Computer_Backup\Roaming\Outlook %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\AppData\Roaming\Microsoft\Signatures" H:\Computer_Backup\Roaming\Signatures %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\AppData\Roaming\Microsoft\Word" H:\Computer_Backup\Roaming\Word %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\AppData\Local\Microsoft\Outlook" H:\Computer_Backup\Local\Outlook %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"
ROBOCOPY "%userprofile%\AppData\Local\Google" H:\Computer_Backup\Roaming\Google %_what% %_options% /+LOG:"C:\backup-logs\%yyyy%%mm%%dd%_-_shutdown-backup.txt"