【问题标题】:Add a progress bar to PST copy batch file向 PST 复制批处理文件添加进度条
【发布时间】:2013-08-08 17:29:46
【问题描述】:

我有一个复制脚本的基础(使用 xcopy)来复制文件,以便从一台电脑迁移到另一台电脑(在我的情况下是 xp 到 win7)。

代码如下: ...

xcopy /I /Y /E /F "C:\Documents and Settings\%USERNAME%\Favorites\*.*" h:\Restore\IE favorites
xcopy /I /Y /S /F "C:\Documents and Settings\%USERNAME%\Desktop" h:\restore\desktop
xcopy /I /Y /F "C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Outlook\*.nk2" h:\restore\Outlook-NK2
xcopy /I /Y /F "C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Signatures" h:\restore\Signatures
xcopy /I /Y /F "C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Office\*.acl" h:\restore\Office-AutoCorrectLists
xcopy /I /Y /F "C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Microsoft\Outlook\*.pst" h:\restore\PST1
xcopy /I /Y /F "C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Outlook\*.pst" h:\restore\PST2

xcopy /I /Y /F "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Outlook" h:\restore\Roaming\Outlook
xcopy /I /Y /F "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Signatures" h:\restore\Roaming\Signatures

regedit /s /e H:\restore\HKCU-RestoreODBC.reg "HKEY_CURRENT_USER\Software\ODBC\ODBC.INI"
regedit /s /e H:\restore\HKLM-RestoreODBC.reg "HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI"

regedit /s /e H:\restore\restornetwork.reg "HKEY_CURRENT_USER\Network"
regedit /s /e H:\restore\HKLM-RestoreIECert_machine.reg "HKEY_LOCAL_MACHINE\Software\Microsoft\SystemCertificates"
regedit /s /e H:\restore\HKCU-RestoreIECert_machine.reg "HKEY_CURRENT_USER\Software\Microsoft\SystemCertificates"
regedit /s /e H:\restore\RestorePrinterConnections.reg "HKEY_CURRENT_USER\Printers\Connections

我想在代码的 PST 部分的复制中添加一个进度条,但我不知道从哪里开始。有人介意帮助我提供一些关于如何开始的提示吗?

非常感谢。

【问题讨论】:

    标签: windows batch-file pst


    【解决方案1】:

    使用 ROBOCOPY 代替 XCOPY。参见 ROBOCOPY /?

    【讨论】:

      【解决方案2】:

      如果您不能按照 RGuggisberg 的建议使用 robocopy,则可以使用旧的点表示法:

      echo.|set /p=.
      

      每次调用它,它都会放下一个点。例如,您可以这样称呼它:

      :: hide xcopy output with > nul so dot ticker output will be visible
      xcopy ... > nul
      call :percentage
      regedit ... > nul
      call :percentage
      goto :EOF
      
      :percentage
      echo.|set /p=.
      goto :EOF
      

      也可以在任何操作后调用。

      【讨论】:

      • 我想他想复制.PST文件时显示一个进度条。这段代码不会那样做。
      • 非常感谢大家的投入,我将测试 dot 示例,看看这是否有助于查看任何文件复制的进度 - .pst 文件可能非常大,因此是一个视觉指示器会很好:)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-04
      • 1970-01-01
      • 2015-06-21
      • 1970-01-01
      • 2017-01-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多