用于检测是否已插入笔式驱动器的批处理文件

时间:2022-01-12 01:22:44

I have to write a batch file which does the following: When a pen drive is inserted it has to copy all the *.mp3 files from the pendrive to my C drive. I thought I can achieve this by running a batch file which runs as a windows service or something, as I don't want the user to know that the mp3 files are being copied.

我必须编写一个批处理文件,它执行以下操作:当插入笔式驱动器时,它必须将所有* .mp3文件从pendrive复制到我的C驱动器。我认为我可以通过运行作为Windows服务或其他东西运行的批处理文件来实现这一点,因为我不希望用户知道正在复制mp3文件。

Thanks a lot!

非常感谢!

1 个解决方案

#1


0  

See "How can I run a batch file in the background (no windows displayed)?" on how to start a hidden batch file in the backgrond. To detect a pen drive, you can detect if a drive letter exists, see "How do I test if a file is a directory in a Batch script?", or How can I detect the drive letter of a booted USB drive from script?

请参阅“如何在后台运行批处理文件(不显示窗口)?”关于如何在背景中启动隐藏的批处理文件。要检测笔式驱动器,您可以检测是否存在驱动器盘符,请参阅“如何测试文件是否是批处理脚本中的目录?”,或者如何从脚本中检测引导的USB驱动器的驱动器号?

#1


0  

See "How can I run a batch file in the background (no windows displayed)?" on how to start a hidden batch file in the backgrond. To detect a pen drive, you can detect if a drive letter exists, see "How do I test if a file is a directory in a Batch script?", or How can I detect the drive letter of a booted USB drive from script?

请参阅“如何在后台运行批处理文件(不显示窗口)?”关于如何在背景中启动隐藏的批处理文件。要检测笔式驱动器,您可以检测是否存在驱动器盘符,请参阅“如何测试文件是否是批处理脚本中的目录?”,或者如何从脚本中检测引导的USB驱动器的驱动器号?