62,269
社区成员
发帖
与我相关
我的任务
分享
function test()
{
var fso,f,r,s,e,x,m;
var ForReading = 1,RorWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
e = new Enumerator(fso.Drives)
s = "test.txt";//假设要读的是usb设备里的一个叫test.txt的文本文件
for(;!e.atEnd();e.moveNext())
{
x = e.item();
if(x.DriveType == 1)
{
if(x.Path != "A:")
{
m = x.Path;
f = fso.OpenTextFile(m+"\\"+s,ForReading);
r = f.ReadAll();
alert(r);
}
}
}
if(m == "" || m == null){alert("找不到USB设备或指定文件不存在USB设备上!");}
}