我需要在脚本中返回当前用户桌面的路径。现在我知道你可以用 WScript 做到这一点。
var WshShell = WScript.CreateObject("WScript.Shell");
strDesktop = WshShell.SpecialFolders("Desktop");
但是对于我的脚本,这将不起作用,因为我不能使用 WScript。但我可以使用 shell.application 对象,如下所示。
dim objShell
dim ssfWINDOWS
dim objFolder
ssfWINDOWS = 0
set objShell = CreateObject("shell.application")
set objFolder = objshell.BrowseForFolder(0, "Example", 0, ssfWINDOWS)
if (not objFolder is nothing) then
Set objFolderItem = objFolder.Self
g_objIE.Document.All("logdir").Value = objFolderItem.path
end if
set objFolder = nothing
set objShell = nothing
什么是语法,而不是“BrowseForFolder”,我可以简单地返回当前用户桌面的路径?
IE换行
set objFolder = objshell.BrowseForFolder(0, "Example", 0, ssfWINDOWS)
与 的等价物。
strDesktop = WshShell.SpecialFolders("Desktop");
干杯
亚伦