Windows スクリプト ファイル (.wsf) を使用する

http://www.microsoft.com/japan/msdn/library/default.asp?url=/japan/msdn/library/ja/script56/html/wsAdvantagesOfWs.asp

外部ファイルのインクルード

以下のようにすることで外部ファイルをインクルードすることができます。

* 準備

Const ForReading = 1
 
Dim FileShell
Set FileShell = WScript.CreateObject("Scripting.FileSystemObject")

Function ReadFile(ByVal FileName)
  ReadFile = FileShell.OpenTextFile(FileName, ForReading, False).ReadAll()
End Function

' グローバルに使用したい場合

Execute ReadFile("stdlib.vbs")
 
Function HogeCalculate(ByVal ...)
  ' 関数( Function or Sub )内でのみ使用したい場合
  Execute ReadFile("mathlib.vbs")
      ...
End Function


GetFreeSpace? †

function GetFreeSpace(drvPath) {
 var fs, d, s;
 fs = new ActiveXObject("Scripting.FileSystemObject");
 d = fs.GetDrive(fs.GetDriveName(drvPath));
 s = "Drive " + drvPath + " - " ;
 s += d.VolumeName;
 s += " Free Space: " + d.FreeSpace/1024 + " Kbytes";
 return s;
}