|
|
|
| 13 December 2002 | AllSpecialFolders() |
| Author | Chris S. |
| Action | Dynamically sets variables with the path of all available Windows special folders. |
| Syntax | AllSpecialFolders () |
| Parameters | |
| Remarks | This function retrieves paths to special folders using the special folder name as the index. A special folder's path depends on the user environment. The information stored in a special folder is unique to the user logged onto the computer system. If several different users have accounts on the same computer system, several different sets of special folders are stored on the hard disk. If the special folder does not exist (e.g. AllUsersPrograms on a Windows 95 computer), then the resulting string will be empty. The following strings will be created: $AllUsersDesktop $AllUsersStartMenu $AllUsersPrograms $AllUsersStartup $AppData $Desktop $Favorites $Fonts $MyDocuments $NetHood $PrintHood $Programs $Recent $SendTo $StartMenu $Startup $Templates |
| Returns | Path to special folder item @ERROR = 0 : Operation Completed Successfully @ERROR = 1 : Unable to instantiate WScript.Shell object |
| Dependencies | KiX 4.02 (or higher) Windows Scripting Host (WSH) 1.0 (or higher) |
| Examples | AllSpecialFolders() $AllUsersDesktop ? $AllUsersStartMenu ? $AllUsersPrograms ? $AllUsersStartup ? $AppData ? $Desktop ? $Favorites ? $Fonts ? $MyDocuments ? $NetHood ? $PrintHood ? $Programs ? $Recent ? $SendTo ? $StartMenu ? $Startup ? $Templates ? |
| Source |
FUNCTION AllSpecialFolders ()
DIM $sallfolders, $objwshshell, $folder, $nul
GLOBAL $allusersdesktop, $allusersstartmenu, $allusersprograms, $allusersstartup,
$appdata, $desktop, $favorites, $fonts, $mydocuments, $nethood, $printhood,
$programs, $recent, $sendto, $startmenu, $startup, $templates
$sallfolders="AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUsersStartup "+
"AppData Desktop Favorites Fonts MyDocuments NetHood PrintHood Programs Recent "+
"SendTo StartMenu Startup Templates"
$objwshshell = CreateObject("WScript.Shell")
IF @error
EXIT(1)
ENDIF
;
FOR EACH $folder IN Split($sallfolders)
$nul=Execute("$"+$folder+" = $$objWshShell.SpecialFolders($$Folder)")
NEXT
$objwshshell=''
EXIT(0)
ENDFUNCTION ; - AllSpecialFolders -
|
|
|
|