0

テキストファイルを作成しようとしていますが、Path not foundエラーが発生します。

私は何を間違っていますか?

var fso = new ActiveXObject("Scripting.FileSystemObject");
    var fo = fso.GetFolder("\\logs")
    var a = fo.CreateTextFile("testfile.txt", true);
    a.WriteLine("This is a test.");
    a.Close();

IE8でJavaScriptを使用しています。ありがとう!

4

1 に答える 1

1

You can try first making sure that the logs directory exists. Next, try including the entire path of the logs directory within the source. This is since the default path of FileSystemObject is the current working directory.

For example, if logs is under C:\logs\

var fso = new ActiveXObject("Scripting.FileSystemObject");
    var fo = fso.GetFolder("C:\\logs")
    var a = fo.CreateTextFile("testfile.txt", true);
    a.WriteLine("This is a test.");
    a.Close();
于 2013-04-08T16:23:57.140 に答える