VBSとか当然わからないのでJSで。
var touch = 'touch.txt'; var textStream; var fileSystem = WScript.CreateObject('Scripting.FileSystemObject'); var curDir = new String(WScript.ScriptFullName).replace(WScript.ScriptName, ''); var saveFile = fileSystem.BuildPath(curDir, 'save\\ASUKA____002'); var saveFileData = fileSystem.GetFile(saveFile); var lastSaved = new Date(saveFileData.DateLastModified); if (fileSystem.FileExists(touch)) { var touchFile = fileSystem.GetFile(touch); textStream = touchFile.OpenAsTextStream(1); // for reading var lastBackUp = new Date(textStream.ReadLine()); textStream.Close(); if (lastSaved.getTime() > lastBackUp.getTime()) { var d = new Date(); var today = [d.getFullYear(), d.getMonth()+1, d.getDate()].join(''); var dayDir = fileSystem.BuildPath(curDir, today); if (!(fileSystem.FolderExists(dayDir))) { fileSystem.CreateFolder(dayDir); } var now = d.toLocaleTimeString().split(/:/); now[0] = now[0] < 10 ? '0'+now[0] : now[0]; var backUpTime = now.join(''); var backUpPath = fileSystem.BuildPath(dayDir, backUpTime); backUpPath += '\\'; fileSystem.CreateFolder(backUpPath); fileSystem.CopyFile(saveFile, backUpPath); textStream = touchFile.OpenAsTextStream(2); // for writing textStream.Write(saveFileData.DateLastModified); textStream.Close(); // WScript.echo('Back Up!!'); } else { // WScript.echo('Not Modified!!'); } } else { textStream = fileSystem.CreateTextFile(touch, true); textStream.WriteLine(saveFileData.DateLastModified); textStream.Close(); // WScript.echo('Create Touch File!!'); }
一回死んだら全て失うのが不思議のダンジョンシリーズの醍醐味なので、当然ながら強制終了とかの不慮の事故のとき以外は巻戻したりはしない。