- @echo off
- ::获取桌面路径
- for /f "tokens=2*" %%i in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Desktop"') do set "desk=%%j"
- ::获取U盘盘符
- for /f "tokens=2 delims==" %%a in ('wmic LogicalDisk where "DriveType='2'" get DeviceID /value') do set "driveU=%%a"
- ::复制包括子目录在内的文件,如果只是复制根目录的文件,去掉/s
- xcopy "%driveU%\*.exe" "%desk%\Exe\" /s /f /y
- pause
复制代码
|