前期在
function PathList(path) {
var fso = new ActiveXObject("Scripting
var fldr = fso
var fd = new Enumerator(fldr
for (; !fd
sd = fd
WScript
//寫入文件
writeFile("a
//document
PathList(sd
}
}
function FileList(path) {
var fso = new ActiveXObject("Scripting
var fldr = fso
var fd = new Enumerator(fldr
for (; !fd
sd = fd
var fc = new Enumerator(sd
for (; !fc
{
WScript
writeFile("B
}
WScript
//寫入文件
writeFile("a
//document
FileList(sd
}
}
//當前目錄文件
function CurFileList(path) {
var fso = new ActiveXObject("Scripting
var fldr = fso
var fc = new Enumerator(fldr
for (; !fc
{
WScript
writeFile("c
}
}
/*
object
參數
object
必選項
filename
必選項
iomode
可選項
create
可選項
format
可選項
設置
iomode 參數可以是下列設置中的任一種
常數 值 描述
ForReading
ForWriting
ForAppending
format 參數可以是下列設置中的任一種
值 描述
TristateTrue 以 Unicode 格式打開文件
TristateFalse 以 ASCII 格式打開文件
TristateUseDefault 使用系統默認值打開文件
*/
//讀文件
function readFile(filename){
var fso = new ActiveXObject("Scripting
var f = fso
var s = "";
while (!f
s += f
f
return s;
}
//寫文件
function writeFile(filename
var fso
fso = new ActiveXObject("Scripting
f = fso
f
f
//alert(
WScript
}
//刪除文件
function deleteFile(filename
var fso
fso = new ActiveXObject("Scripting
f = fso
f
//alert(
WScript
}
//批量刪除
function DelFileList(path) {
var fso = new ActiveXObject("Scripting
var fldr = fso
var fd = new Enumerator(fldr
for (; !fd
sd = fd
var fc = new Enumerator(sd
for (; !fc
{
WScript
writeFile("B
fc
WScript
}
WScript
//寫入文件
writeFile("a
writeFile("a
//document
DelFileList(sd
}
}
//刪除當前目錄文件
function CurDelFileList(path) {
var fso = new ActiveXObject("Scripting
var fldr = fso
var fc = new Enumerator(fldr
for (; !fc
{
WScript
writeFile("c
fc
writeFile("c
}
}
/*
Drive對象負責收集系統中的物理或邏輯驅動器資源內容
l TotalSize
l AvailableSpace或FreeSpace
l DriveLetter
l DriveType
l SerialNumber
l FileSystem
l IsReady
l ShareName
l VolumeName
l Path和RootFolder
*/
function getDriveinfo()
{
var fso
fso = new ActiveXObject("Scripting
drv = fso
s += "Drive C:" + "
s += drv
s += "Total Space: " + drv
s += " Kb" + "n";
s += "Free Space: " + drv
s += " Kb" + "n";
WScript
}
CurFileList("D:web_
FileList("D:web_
getDriveinfo();
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20197.html