使用批处理文件的文件复制到USB闪存驱动器根 [英] Copy a file into USB flash drive root using batch files

查看:120
本文介绍了使用批处理文件的文件复制到USB闪存驱动器根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个批处理文件,将文件从任何目录复制到.bat文件位于像USB闪存驱动器的根文件夹。

I want to create a batch file to copy a file from any Dir into root folder that the .bat file located on that like a USB flash drive .

我的不完整的命令:

    xcopy /s "%userprofile%\Desktop\test.txt" "?"

我能和替代哪些? ???
谢谢你们

What can I replace with "?" ??? Thanks guys

推荐答案

这将不正是你想要的任何及所有连接的USB驱动器。

This will do exactly as you want to any and all connected USB drives.

@echo off

for /F "usebackq tokens=1,2,3,4 " %%i in (`wmic logicaldisk get caption^,description^,drivetype 2^>NUL`) do (

if %%l equ 2 (
xcopy /s "%userprofile%\Desktop\test.txt" %%i\
        )
        )

这篇关于使用批处理文件的文件复制到USB闪存驱动器根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆