だろうOK。 .jsファイルとして保存し、 "wscript c:/script.js"でdosから実行してください。
var fso, f, fileCount;
var ForReading = 1, ForWriting = 2;
var filename = "c:\\testfile.txt";
fso = new ActiveXObject("Scripting.FileSystemObject");
//create file if its not found
if (! fso.FileExists(filename))
{
f = fso.OpenTextFile(filename, ForWriting, true);
f.Write("0");
f.Close();
}
f = fso.OpenTextFile(filename, ForReading);
fileCount = parseInt(f.ReadAll());
//make sure the input is a whole number
if (isNaN(fileCount))
{
fileCount = 0;
}
fileCount = fileCount + 1;
f = fso.OpenTextFile(filename, ForWriting, true);
f.Write(fileCount);
f.Close();