我需要获取计算机的用户文件夹名称并将其放入路径中,在本例中为启动和桌面路径。我想出了如何找到用户文件夹名称,但我一直在弄清楚如何将其放入路径中。有谁知道怎么做?
Set WshShell = CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
这将是一个很大的帮助。
编辑
Set objShell = Wscript.CreateObject("Wscript.Shell")
strPath = objShell.SpecialFolders("Startup")
wscript.echo strPath
dim WSHShell, desktop, pathstring, startup, objFSO
set objFSO=CreateObject("Scripting.FileSystemObject")
Set WSHshell = CreateObject("WScript.Shell")
desktop = WSHShell.SpecialFolders("Desktop")
pathstring = objFSO.GetAbsolutePathName(desktop)
WScript.Echo desktop
set filesys=CreateObject("Scripting.FileSystemObject")
filesys.CopyFile "desktop", dolpis.vbs,"startup", dolpis.vbs
set objFso=createObject("scripting.fileSystemObject")
set objWShell=wScript.createObject("WScript.Shell")
usrName=objWShell.expandEnvironmentStrings("%USERNAME%")
if objFso.folderExists(strFolder) then
objFso.copyFile strFileToCopy,strFolder&"\",True
else
msgbox "The folder " & strFolder & " does not exist"
end if
CreateObject("WScript.Shell").Run("C:\WINNT\system32\notepad.exe")
Set wshshell = wscript.CreateObject("WScript.Shell")
第 11 行声明“需要对象:Dolpis”