1

次の関数は \My Documents\ を省略しても機能しますが、ドキュメントにアクセスする必要があります。

OpenTextFile("test.txt");

function OpenTextFile(file) {
    var ObjShell = new ActiveXObject("Shell.Application");
    var wShell   = new ActiveXObject("WScript.Shell");
    var path     = wShell.ExpandEnvironmentStrings("%userprofile%\My Documents\");
    ObjShell.ShellExecute("Notepad.exe", file, path, "Open", "1");
}

そのままでは、エラーが表示されます: Unterminated string constant Line 7 Char 80

4

3 に答える 3