如果省略 \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