简体   繁体   English

批处理循环文件搜索

[英]batch for loop file search

@ECHO OFF 
SET driveLetter=%~d0
FOR /R %%x IN (*.pst) DO (
    ROBOCOPY %%x %driveLetter%\%%x /E /COPYALL /ZB /MT:20 /XJ /R:2 /W:5
)
PAUSE
EXIT

I can't get this working. 我无法正常工作。 What I want to do is search the user folder (incl. subfolders) for any .pst files and then copy these to a flash drive. 我想做的是在用户文件夹(包括子文件夹)中搜索任何.pst文件,然后将它们复制到闪存驱动器中。

Pretty simple actually just use xcopy: 很简单,实际上只是使用xcopy:

xcopy c:\users\%username%\*.pst F:\ /e

(replace F:/ with drive location if its not F). (如果驱动器位置不是F,则用驱动器位置替换F:/)。

@ECHO OFF 
SET driveLetter=%~d0
ROBOCOPY %USERPROFILE% %driveLetter%\Outlook *.pst /S /COPYALL /ZB /XJ /MT:20 /R:2 /W:5
PAUSE
EXIT

Solution. 解。 Thanks to everybody. 感谢大家。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM