Get special folder paths

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 808
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Get special folder paths

Post by Grovkillen » Tue May 18, 2021 5:59 am

I have previously posted the tip on how to create a link file. I have now found a way of getting some special folder paths.

This one will get the "ProgramData" path:

Code: Select all

  VBSTART
  Function GetFolder(FolderToGet)
    Set WShell = CreateObject("Shell.Application")
    GetFolder = WShell.Namespace(CInt(FolderToGet)).Self.Path
    Set WShell = Nothing
  End Function
  VBEND
  Let>FOLDER_NUM=35
  VBEval>GetFolder("%FOLDER_NUM%"),SPECIAL_FOLDER_PATH
FOLDER_NUM is any of these:

Code: Select all

DESKTOP = 0
PROGRAMS = 2
CONTROLS = 3
PRINTERS = 4
PERSONAL = 5
FAVORITES = 6
STARTUP = 7
RECENT = 8
SENDTO = 9
BITBUCKET = 10
STARTMENU = 11
DESKTOPDIRECTORY = 16
DRIVES = 17
NETWORK = 18
NETHOOD = 19
FONTS = 20
TEMPLATES = 21
COMMONSTARTMENU = 22
COMMONPROGRAMS = 23
COMMONSTARTUP = 24
COMMONDESKTOPDIR = 25
APPDATA = 26
PRINTHOOD = 27
LOCALAPPDATA = 28
ALTSTARTUP = 29
COMMONALTSTARTUP = 30
COMMONFAVORITES = 31
INTERNETCACHE = 32
COOKIES = 33
HISTORY = 34
COMMONAPPDATA = 35
WINDOWS = 36
SYSTEM = 37
PROGRAMFILES = 38
MYPICTURES = 39
PROFILE = 40
SYSTEMx86 = 41
Reference: https://docs.microsoft.com/sv-se/window ... dfrom=MSDN

PS. the SENDTO (9) is a pretty cool folder. Create a link file here and you are able to send files into your scripts straight from the explorer app.
Let>ME=%Script%

Running: 15.0.20
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts