This example retrieves the Application Data folder:
VBSTART
Function GetFolder(Folder)
Set WShell = CreateObject("WScript.Shell")
GetFolder = WShell.SpecialFolders(Folder)
Set WShell = Nothing
End Function
VBEND
//See following for list of available folder types:
//http://msdn.microsoft.com/library/en-us ... olders.asp
VBEval>GetFolder("AppData"),AppData
MessageModal>AppData
Other folder names include:
AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
An alternative method for some paths is to use GetEnvVar:
GetEnvVar>APPDATA,result
GetEnvVar>USERPROFILE,result
Type SET in a command prompt to see the values available.
Get Special Folders such as user's Application Data folder
Moderators: JRL, Dorian (MJT support), Phil Pendlebury
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
I know this is an old post but I have been using these commands on a recent script and like to add that it's possible to do this without VBScript.
Just use:
ExecuteFile>shell:%COMMAND%
Where "COMMAND" is anyone of the below:
Appdata
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
Ok, so I've used this to get the Startup folder since my clients user names sometimes is got the domain name attached (.DOMAIN)... but my problem is that it's somewhat cumbersome to find the correct patch using this (I have to scan the open window...)
C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
could sometimes be
C:\Users\USERNAME.DOMAIN\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
I'd be happy if someone could help me with this (is it possible to collect the folder path some other way?)
Just use:
ExecuteFile>shell:%COMMAND%
Where "COMMAND" is anyone of the below:
Appdata
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
Ok, so I've used this to get the Startup folder since my clients user names sometimes is got the domain name attached (.DOMAIN)... but my problem is that it's somewhat cumbersome to find the correct patch using this (I have to scan the open window...)
C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
could sometimes be
C:\Users\USERNAME.DOMAIN\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
I'd be happy if someone could help me with this (is it possible to collect the folder path some other way?)
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
- Dorian (MJT support)
- Automation Wizard
- Posts: 1414
- Joined: Sun Nov 03, 2002 3:19 am
Don't worry, Grovkillen.
Maybe this is a good place to post a list of system variables. I'd think a lot of these have been added since the original thread was created.
http://www.mjtnet.com/manual/index.html ... iables.htm
Probably the most important one of these is USERDOCUMENTS_DIR
Examples :
XLOpen>%USERDOCUMENTS_DIR%\mybook.xlsx,1,xlBook
ReadLn>%userdocuments_dir%\L and K\illegalchar.txt,1,char1
Let>inFolder=%USERDOCUMENTS_DIR%\Websites\
Let>outFolder=%USERDOCUMENTS_DIR%\Websites\new\
WriteLn>%USERDOCUMENTS_DIR%\L and K\url output.txt,result,Hello

Maybe this is a good place to post a list of system variables. I'd think a lot of these have been added since the original thread was created.
http://www.mjtnet.com/manual/index.html ... iables.htm
Probably the most important one of these is USERDOCUMENTS_DIR
Examples :
XLOpen>%USERDOCUMENTS_DIR%\mybook.xlsx,1,xlBook
ReadLn>%userdocuments_dir%\L and K\illegalchar.txt,1,char1
Let>inFolder=%USERDOCUMENTS_DIR%\Websites\
Let>outFolder=%USERDOCUMENTS_DIR%\Websites\new\
WriteLn>%USERDOCUMENTS_DIR%\L and K\url output.txt,result,Hello