批量列出USB驱动器,然后复制内容 [英] Batch list usb drives, then copy content

查看:22
本文介绍了批量列出USB驱动器,然后复制内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个列出 USB 驱动器的批处理文件(通常是一个已连接的驱动器),然后 cd 到驱动器或从驱动器复制内容.

I'm trying to make a batch file that list usb drive (it's usually one connected), then either cd in to the drive or copy the contents from the drive.

我正在尝试使用 wmic 列出驱动器,但我得到了驱动器号.但是我不知道如何使用从 wmic 获得的信息执行 cd 命令.

I'm trying to to use wmic to list the drive, and I get the drive letter. But I have no idea how to execute the cd command using the information I got from wmic.

wmic 命令:

wmic volume where "drivetype=2" get driveletter /format:table | findstr : 

推荐答案

为什么不使用 Powershell 列出磁盘然后过滤 USB 驱动器并从那里开始?

Why not use Powershell to list the disks then filter for USB drives and go from there?

推荐进一步阅读:http://blogs.technet.com/b/heyscriptingguy/archive/2013/08/26/automating-diskpart-with-windows-powershell-part-1.aspx

Powershell 脚本:https://gallery.technet.microsoft.com/DiskPartexe-Powershell-0f7a1bab

Powershell script: https://gallery.technet.microsoft.com/DiskPartexe-Powershell-0f7a1bab

尝试其中的一些命令并回复您想要执行的操作和您的 Powershell 尝试,我们将帮助改进.

Try out some of those commands and reply back with what you want to do and your Powershell attempts and we'll help refine that.

这篇关于批量列出USB驱动器,然后复制内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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