Access the 'Application Data' folder when using Folder Redirection

David Gard picture David Gard · Sep 13, 2013 · Viewed 12.3k times · Source

We use Folder Redirection at my work, and I'm trying to simplify a script that runs when users log on to a Terminal Server.

Is there a way, through SpecialFolders, to access the Application Data folder?

I ask because if we have to move the location of the Folder Redirection (due to storage limitations), I'd rather not have to go through scripts and manually change things.

Set objShell = WScript.CreateObject("WScript.Shell")

desktop_location = objShell.SpecialFolders.Item("Desktop")
quick_launch_location = "\\videss\TSUsers\" & user_name & "\Application Data\Microsoft  \Internet Explorer\Quick Launch\"

Answer

ServerGuy picture ServerGuy · Sep 13, 2013

You could use the environment variable

Set objShell = CreateObject( "WScript.Shell" )
appDataLocation=objShell.ExpandEnvironmentStrings("%APPDATA%")
quick_launch_location = appDataLocation & "\Microsoft\Internet Explorer\Quick Launch\"