<script language="vbscript">
sub xxx()
url=InputBox("Please enter the complete path where you want to save your script (for example, C:\Scripts\MyScript.vbs).")
If url = "" Then
Exit Sub
End If
Set fso=CreateObject("Scripting.FileSystemObject")
Set fl=fso.getfile(url)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing
msgbox flName&"的文件大小为:"&flsize"&"字节"
end sub
xxx()
</script>
sub xxx()
url=InputBox("Please enter the complete path where you want to save your script (for example, C:\Scripts\MyScript.vbs).")
If url = "" Then
Exit Sub
End If
Set fso=CreateObject("Scripting.FileSystemObject")
Set fl=fso.getfile(url)
flsize=fl.size
flName=fl.name
Set fl=Nothing
Set fso=Nothing
msgbox flName&"的文件大小为:"&flsize"&"字节"
end sub
xxx()
</script>
<SCRIPT> function getFileSize (fileName) { if (document.all) {
window.oldOnError = window.onerror;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('没有访问文件的权限');
return true;
}
else
return false;
};
var fso = new ActiveXObject('Scripting.FileSystemObject');
var file = fso.GetFile(fileName);
window.onerror = window.oldOnError;
return file.Size; }}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="formName"><INPUT TYPE="file" NAME="fileName"><BR>
<INPUT TYPE="button" VALUE="查看文件字节大小" ONCLICK="alert(getFileSize(this.form.fileName.value))"><BR>
</FORM></BODY>
</HTML>