There are not many VBS scripts in the forum. But if you go through them all, the owner's problem will no longer be a problem.
arrArgs = Array("None", "IE", "All Programs", "Control Panel", "Printers and Faxes", _
"My Documents", "Favorites", "Startup", "Recent Documents", "Send To", _
"Recycle Bin", "Start Menu", "Pending", "My Music", "My Videos", _
"Pending", "Desktop", "My Computer", "Network Neighborhood", "NetHood", _
"Fonts", "Templates", "All User Start Menu", "All User All Programs", _
"All User Startup", "All User Desktop", "MY_AppData", "PrintHood", _
"MY_AppData2", "Pending", "Pending", "All User Favorites", "IE Cache", _
"Cookies", "History", "All User AppData", "Windows", "System32", _
"Programs", "My Pictures", "Current User Root Directory", "Public Components", "Pending", _
"Pending", "Pending", "All User Templates", "Shared Documents", _
"All User Management", "Administrative Tools", "Network Connections", "Pending", "Pending", _
"Pending", "All User Music", "All User Pictures", "All User Videos", _
"Desktop Themes", "Resources2", "none", "CD_Burning")
For i = 1 To UBound(arrArgs)
If arrArgs(i) = "Current User Root Directory" Then intNumber = i
Next
str = "Set objShell = CreateObject(" & Chr(34) & _
"Shell.Application" & Chr(34) & ")" & vbLf & _
"Set objFolder = objShell.Namespace(" & intNumber & ")" & vbLf &_
"Set objFolderItem = objFolder.Self" & vbLf & _
"strDir = objFolderItem.Path"
Execute str
Wscript.Echo "The code to get ★" & strDir & "★:" & vblf & vblf & str
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "about:blank"
objIE.document.parentwindow.clipboardData.SetData "text", str
objIE.Quit
WScript.Echo "The code has been copied to the clipboard!"
Set objIE = Nothing
Reference link:
SendTo + Batch Processing Practical Small Tool - Enhanced Send To
In VBS, you can also get some system directories using Wscript.Shell, but since its content is too little, I rarely use it:
WScript.Echo CreateObject("Wscript.Shell").SpecialFolders("Desktop")
The directories it can get are:
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
In addition, regarding obtaining environment variables, you can try to implement it using WMI:
For Each x In GetObject("winmgmts:\\.\root\cimv2:Win32_Environment").Instances_
WScript.Echo x.Name & ":" & vbTab & x.VariableValue
Next
Templates