This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
createTMP=function(name, str){ | |
var fs=fso.AXO, path=fso.gsf2+'\\'+(new Date()).getTime(), path0=path, i=0, path1 | |
while(fs.FolderExists(path)){ path=path0+(i++) } | |
fs.CreateFolder(path) | |
path1 = path+'\\'+name | |
return fso.Write(path1, str), {path:path1, dir:path, close:function(){ fs.FolderExists(this.dir) && fs.DeleteFolder(this.dir) }} | |
} | |
fso=function(){ | |
var fs=new ActiveXObject('Scripting.FileSystemObject') | |
return { | |
AXO:fs, | |
gsf2:fs.GetSpecialFolder(2), // Z:\TEMP | |
Read:function(path, swCreate, swUnicode){ | |
if(!fs.FileExists(path)){return} | |
with(fs.OpenTextFile(path, 1, swCreate, swUnicode)){ var str=AtEndOfStream ? '' : ReadAll(); Close() } | |
return str | |
}, | |
Write:function(path,str,swUnicode,sw上書きしない){ with(fs.CreateTextFile(path, !sw上書きしない, swUnicode)){ Write(str); Close() } } | |
} | |
}() | |
var arr=[],i=0, obj=createTMP('aaa.js', 'WScript.Echo(1)') | |
arr[i++] = obj.path | |
arr[i++] = obj.dir | |
arr[i++] = fso.AXO.FolderExists(obj.dir) | |
obj.close() | |
arr[i++] = fso.AXO.FolderExists(obj.dir) | |
WScript.Echo(arr.join('\n')) |
実行結果

0 件のコメント:
コメントを投稿